Skip to main content

Convert geographic rasters into simplified polygons

Project description

Geopolygonize

Convert geographic rasters into simplified polygons. Given an input raster file, this tool produces a gpkg file 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"

Options + API

Refer to the docs.

Development

Install the dependencies:

pip install -r requirements.txt

Then, run the CLI:

python -m src.geopolygonize --input-file="data/input.tif" --output-file="data/output.shp"

Test against some existing input:

./tests/run_e2e_test.sh <input>

Find test raster inputs here.

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

geopolygonize-0.2.0.tar.gz (142.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geopolygonize-0.2.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file geopolygonize-0.2.0.tar.gz.

File metadata

  • Download URL: geopolygonize-0.2.0.tar.gz
  • Upload date:
  • Size: 142.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for geopolygonize-0.2.0.tar.gz
Algorithm Hash digest
SHA256 97379503264afcd5083fc1e3e2d3943842e37a8b57cb1bcd0c6b8f8657edf9d6
MD5 135f32616e19e46cd6e130b1e65a03dd
BLAKE2b-256 b536732cd9fae106362298e57d86e16b9d5e4375ac0259b8b18ebfaf48d22dd8

See more details on using hashes here.

File details

Details for the file geopolygonize-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: geopolygonize-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for geopolygonize-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ebc2ec245f1cca524d5511ed1392288ad647c12190d6095a8382e8b9ba0a576
MD5 c5d7708714c2135832664a333a737f10
BLAKE2b-256 44f07b8f2a2525dc5a1685f7a4a99fa8b12519707166e34b9db6fe2fa0a06850

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page