priorityclip-geo
Turn overlapping polygons into a deterministic, priority-respecting partition.
Overlapping administrative areas, work zones, or classification polygons cannot
always coexist in a final layer. priorityclip assigns every shared square metre
to exactly one source feature, preserves the total union, and writes an audit table
showing what was removed.
Quick start
python -m pip install priorityclip-geo
priorityclip partition areas.gpkg \
--layer candidates \
--priority priority \
--output partitioned.gpkg \
--report areas.csv
Lower numeric values win. Equal values retain stable input order. Output rows are written in the order in which they were processed.
Reproducible example
The bundled example creates three synthetic polygons in EPSG:3857. No external data is required.
python examples/make_example.py
priorityclip partition examples/overlap.geojson \
--priority priority \
--output examples/partitioned.gpkg \
--report examples/areas.csv
Expected area audit:
| source row | priority | source m² | result m² | removed m² |
|---|---|---|---|---|
0 (alpha) |
1 | 100 | 100 | 0 |
1 (beta) |
2 | 100 | 60 | 40 |
2 (gamma) |
3 | 80 | 40 | 40 |
The result has zero pairwise overlap and the same 200 m² union as the input.
Python API
from priorityclip import PartitionResult, partition
result: PartitionResult = partition(frame, "priority")
result.geometries.to_file("partitioned.gpkg", layer="partitioned")
result.report.to_csv("areas.csv", index=False)
partition(frame, priority, *, tolerance=None) accepts a GeoDataFrame and the
name of a numeric priority column. PartitionResult exposes:
geometries: attributes plus the non-overlapping output geometry;report: source index, priority, source/result/removed area, part count, and whether the result became empty;- source and result union areas;
- maximum coverage error and pairwise overlap.
Guarantees
- Lower numeric priority owns shared area.
- Equal priorities preserve source order.
- Source attributes and one output row per input row are retained.
- The output union matches the input union within a scale-aware tolerance.
- Pairwise result overlap remains below the same tolerance.
- CLI outputs are replaced atomically after successful processing.
Limits
- Input geometries must be valid Polygon or MultiPolygon features.
- The CRS must be projected with horizontal units in metres.
- Invalid, missing, or empty input geometries are rejected rather than repaired.
- Repeated pairwise overlap validation is intended for small and medium datasets; very large layers may need spatial indexing in a future release.
Run priorityclip --help for all CLI options. Exit code 0 means success and 2
means invalid input or a processing failure.
Development
python -m pip install -e ".[test]"
python -m ruff check .
python -m ruff format --check .
python -m pytest
Copyright 2026 Alena Nikitina. Licensed under the Apache License 2.0.
Release files for priorityclip-geo 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| priorityclip_geo-0.1.1.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| priorityclip_geo-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.6 kB
Release files / priorityclip_geo-0.1.1.tar.gz
| Download URL | priorityclip_geo-0.1.1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
567388fabc995b8734ac89e50ebe198c83bc5d90c6e67af7a287a4a4723c7af3
|
|
BLAKE2b-256 checksum How to use checksums |
582717820d8a3ab32d28a6d0c843d80ad37d611fa870e65095b624315c845b8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / priorityclip_geo-0.1.1-py3-none-any.whl
| Download URL | priorityclip_geo-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c4c6e1472b5a60f2ab90131fa616314c472fd21c251ca0fc26b7786ee34f3f3
|
|
BLAKE2b-256 checksum How to use checksums |
354f167b2242668a92e794862d3ae55df828b4153182ed64d7b98f62180e261b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency log