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.2.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.2-py3-none-any.whl (145.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: geopolygonize-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 79e5eeb62c6a3c08567131f3534696c179b4f80bb51b47dfa8498ab2ff42a20c
MD5 8daaca8e1c4302f2b7c05de890ca65d2
BLAKE2b-256 666e644247c4a7224391b31972ef6748a99afb054697a12745e2c21423811496

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geopolygonize-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 145.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c98f2be4267d9fef5c2f1b896590e8338042f730fbbdb7c6ed543dc5cd1b7ea
MD5 06d1f3297f93a3171d943b5cc77e8095
BLAKE2b-256 a35fe64330bfae1ed343cb5773556e1472095f458bbaf76d0041e777f16b0d0d

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