Skip to main content

A geospatial package for cleaning up polygon data.

Project description

polyclean

Clean up geospatial polygon datasets.

This package provides utilities for cleaning up messy polygon data in geospatial datasets. It aims to provide solutions to common issues such as holes, gaps, and overlaps. Generally, functions expect a geopandas.GeoDataFrame as input and will return one as well. Polygons are thus always passed around as data frames, making it easy to translate them to and from commonly used geospatial file formats (e.g. OGC GeoPackage, ESRI Shapefile). This has the added benefit of mimicking the way vector workflows are done in QGIS or ArcGIS, making the package more intuitive to use (hopefully).

This package relies heavily on Geopandas and Shapely, so understanding how those packages handle vector data will aid with understanding polyclean utilities.

Installation

UNIX-like (Linux, MacOS)

pip install polyclean

This should install the package and all necessary dependencies.

Windows

Make sure you have the following packages installed first:

  • Fiona >= 1.8
  • GDAL >= 3.2

Any recent version (compatible with Shapely >= 1.8) should suffice.

Examples

Fill Holes

Holes in polygons can be filled in based on area. To fill in all holes in a dataset, set the threshold value to a very large value (e.g. 1e6).

holes_examplepng

Fill Gaps

Gaps between polygons can be identified and eliminated. A new field called gap is created, with gap polygons given a value of 1 and non-gap polygons (i.e. the original polygons) given the value NaN. These gaps can be automatically removed by folding them into the polygon with which they share the longest edge. This mimics the functionality of the the ArcGIS Eliminate tool.

combined

Resolve Overlaps

Overlapping regions between polygons can be identified, extracted, and, optionally, flattened.

Screen Shot 2022-01-30 at 12 50 43 AM

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

polyclean-0.1.9.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

polyclean-0.1.9-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file polyclean-0.1.9.tar.gz.

File metadata

  • Download URL: polyclean-0.1.9.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for polyclean-0.1.9.tar.gz
Algorithm Hash digest
SHA256 531f806003c5fd5d5b82910411353bb75e062fdf457a156e339a5b0611a3c4d1
MD5 dcc705783432f1e1d5adb65f5b478c03
BLAKE2b-256 11dbd76cd9236d57fd101c6ab3b57de03abdae04daf632cdb52b4d727fb7057e

See more details on using hashes here.

File details

Details for the file polyclean-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: polyclean-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for polyclean-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7e59b86a0157842ba28b64abb2a2ae023790f176b40aecabe32cab469e289084
MD5 be1df428725d1034ea168b25a68ab67d
BLAKE2b-256 f7ccd9b3f7b8787cb52988916ab30cdcf23c63478f29643ebc5126a3d483cf2a

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