Convert geographic rasters into simplified polygons
Project description
Geopolygonize
Convert geographic rasters into simplified polygons. Given an input raster file, this tool produces a shapefile representation of the raster that simplifies out pixelation. It also maintains shapes' relations to one another such that the output is guaranteed to have no gaps.
Algorithm
Most existing methods for polygon simplification such as the Douglas–Peucker simplification algorithm or concave hulls operate on a single polygon at a time. This presents a problem when run on a collection of polygons that fit together perfectly–simplifying each polygon separately will introduce unpredictable gaps. Our algorithm takes an approach similar to TopoJSON. It identifies the boundaries shared between polygons, simplifies those boundaries, then assigns the simplified boundaries back to the polygons. This results in simplified polygons that fit perfectly together without any gaps.
Install
pip install geopolygonize
Quickstart
To convert a raster to simplified polygons, run:
geopolygonize --input-file="data/input.tif" --output-file="data/output.shp"
CLI Options
--min-blob-size
Optional raster preprocessing step to remove pixels that are not connected to neighboring pixels with the same value. This value dictates the minimum number of pixels of the same value each must be connected to in order to be kept. Pixels in blobs smaller than this value will be removed and filled with the most common pixel value surrounding it.
--tile-size
The polygonization process can be run in parallel to speed up the computation. To prepare to process in parallel, the raster is cut into square tiles of this number of pixels.
--workers
Number of workers that should be spawned to process tiles in parallel.
Development
Install the requirements:
pip install -r requirements.txt
# TODO: API docs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geopolygonize-0.1.3.tar.gz.
File metadata
- Download URL: geopolygonize-0.1.3.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e77f64467d15fda62fa802a1efff709bbdd0ef3c9d9b009460170149e31103
|
|
| MD5 |
316a9de2a1cf5d481235ae6d80fb611a
|
|
| BLAKE2b-256 |
7f0fe094f0a6901bc789272281293def128595706400356bd210650973a59b67
|
File details
Details for the file geopolygonize-0.1.3-py3-none-any.whl.
File metadata
- Download URL: geopolygonize-0.1.3-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b686d5f73b35ccd2d711accdbcbf390150452ba0b8b22e61bab670b65bb093
|
|
| MD5 |
eb608cff1a818f2118852ea3a465fb38
|
|
| BLAKE2b-256 |
e1e5245fc9202fa3d28113f00d51bbbab7a349e29c47c76147c21fec6bf46272
|