ForesTiler — Create Image Tiles From Large Input Rasters According to a Classified Mask Vector File
ForesTiler provides a CLI tool to create image tiles from large input rasters according to a classified mask vector file. The goal is to export images that are completely covered by a class polygon. They can be saved either as PNGs to directly feed them into machine learning frameworks which may not interop with geodata or as GeoTIFFs when retention of geographic information is deemed important.
Installation
You can install forestiler via pip by running
pip install forestiler
Usage
usage: forestile [-h] [--no-progress] [--pad] [--kernel-size KERNEL_SIZE] [--stride STRIDE]
--vector-mask VECTOR_MASK [--class-field CLASS_FIELD] [--all-classes]
[--classes CLASSES [CLASSES ...]] [--input-glob INPUT_GLOB] [--geo-tiff]
input out
forestile creates image tiles from large input rasters according to a classified mask vector file.
positional arguments:
input Directory containing raster files to tile.
out Directory where output files should be stored.
May not exist prior to program invocation.
optional arguments:
-h, --help show this help message and exit
--no-progress Disable progress bar
--pad Disable padding of input images.
--kernel-size KERNEL_SIZE
Kernel size in pixels.
--stride STRIDE Stride of kernel.
--vector-mask VECTOR_MASK
Path to vector file. Always reads first layer,
if driver supports multi-layerr files (e.g. Geopackages).
--class-field CLASS_FIELD
Attribute field containing class values.
--all-classes Generate image chips for all unique values in class field.
--classes CLASSES [CLASSES ...]
List of classes to build image tiles for.
--input-glob INPUT_GLOB
Optional glob pattern to filter files in input directory.
--geo-tiff Store image chips as GeoTiffs instead of PNGs.
Copyright: Florian Katerndahl <florian@katerndahl.com>
Example Usage
Given a directory structure like the one listed below, the following command reads the file mask.gpkg and queries all geometries where the attribute "tree" matches "oak".
All output image chips, here as georeferenced TIFF files, are written into the directory output (which may not exist prior to program invocation).
forestile --stride 50 --vector-mask mask.gpkg --class-field tree --classes "oak" --geo-tiff rasters/ output/
.
├── output/
├── rasters/
│ ├── truedop20rgb_386_5808_2_be_2020.tif
│ ├── truedop20rgb_386_5810_2_be_2020.tif
│ ├── truedop20rgb_388_5808_2_be_2020.tif
│ └── truedop20rgb_388_5810_2_be_2020.tif
└── mask.gpkg
Contribution
Bug reports, suggestions and feature requests are always welcomed. Please open an issue on GitHub.
Citation
If you use this package, see CITATION and cite this work.
Acknowledgements
This package was developed at the Remote Sensing Lab at Freie Universität Berlin.
Metadata
Release files for forestiler 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| forestiler-0.2.2.tar.gz | 13.5 kB | Without provenance | Details for forestiler-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| forestiler-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for forestiler-0.2.2-py3-none-any.whl |
Total release size: 28.8 kB
Release files / forestiler-0.2.2.tar.gz
| Download URL | forestiler-0.2.2.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c735817b5863e8aa136e4a47d9905c3fe08931a2e201aec48ceb135861ba0cc0
|
|
BLAKE2b-256 checksum How to use checksums |
a1d7f917f2e8083cf94790b47b3018c26dfcf2ac11e479d1d2297b3944b2c715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.8.10 Linux/5.4.0-152-generic
|
Release files / forestiler-0.2.2-py3-none-any.whl
| Download URL | forestiler-0.2.2-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad24c8d5bcbe1f8f40a807511d0de4f0590ee890f60c335ab990e68e1bced0f5
|
|
BLAKE2b-256 checksum How to use checksums |
e36c733e887158a47d2d2047a33980b02a26940f4a78febfbda6f4f51f877a4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.8.10 Linux/5.4.0-152-generic
|
Security for forestiler 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.