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

Uploaded Python 3

File details

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

File metadata

  • Download URL: geopolygonize-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b4ee3ed39ec3b2bbe36e4a278045661da843b586ec8e338918cea4e4ac1c8ea0
MD5 7043b883ad1088ca079352df1a08815b
BLAKE2b-256 5288916bace001ee3f1e5d263392c0b8a12a079502b3ac4a714b34db1122701c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geopolygonize-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4fe3a1b5cbce315ec7cce0be60bb769defebaaee264cbafeb6ac8ade7c1ec70
MD5 79ef25377f47b6a37eebd0c4101484d2
BLAKE2b-256 4e265e35d177aef9b522aca8b9f23a123407fe024e7aae9173330ae82882eb04

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