Skip to main content

topo-tools

CI PyPI Python versions License: MIT

World ADM0 boundaries extended with Voronoi-filled coastline

topo-tools is a collection of DuckDB-powered geospatial topology utilities for cleaning and reconciling administrative boundary polygons. It ships sixteen tools, usable from the CLI or as a Python package. Composite tools are nested under the primitives they chain internally; every primitive is also usable standalone:

  • schema-crosswalk: infers a source-column to target-schema crosswalk and immediately applies it, in one call.
    • schema-map: infers a polygon layer's admin hierarchy structurally and proposes a source to target-schema crosswalk for review.
    • schema-refactor: applies a crosswalk CSV, from schema-map or hand-edited, to rename or drop columns. Geometry passes through unchanged.
  • schema-fill: cascades each admin-hierarchy column down from its nearest non-NULL shallower level and stamps a depth column.
  • topo-clean: detects and fixes gap/overlap defects in a single polygon layer, reporting issues for manual review.
    • topo-detect: scans a single polygon layer for gap/overlap coverage defects and reports them, without fixing anything.
  • edge-match: fits a finer child polygon layer into a coarser parent layer, grouping and extending each child to fill gaps within its own parent.
    • edge-extend: fills gaps around a polygon layer (missing coastline, disputed areas, water bodies) with a Voronoi extension, producing full coverage.
    • edge-mosaic: re-clips an already-extended child layer into a new/different parent layer, skipping Voronoi extension entirely.
      • edge-clip: assigns each child to its parent, then clips it to that parent's geometry.
      • edge-stitch: closes seams in an already-tiled polygon layer with one whole-table coverage-clean pass.
  • change: compares two versions of a polygon layer and classifies every unit as unchanged, renamed, modified, split, merged, created, or removed.
  • package: runs package-polygons, package-points, and package-lines against one input in a single call.
    • package-polygons: dissolves a polygon layer into every detected coarser admin level in a single call.
    • package-points: one label point per admin unit per detected level, using the pole of inaccessibility.
    • package-lines: one deduplicated line network of admin boundaries, tagged by the coarsest level each segment belongs to.

Installation

Install with uv (recommended):

uv tool install topo-tools   # CLI
uv add topo-tools            # Python library

Or with pip/pipx:

pip install topo-tools       # CLI or library
pipx install topo-tools      # CLI

On macOS/Linux, topo-tools is also available via Homebrew, no Python tooling required:

brew install OCHA-DAP/topo-tools/topo-tools

Each linked doc above covers that tool's CLI/Python usage, options, and examples.

Supported Formats

Polygon inputs/outputs: GeoParquet (.parquet), GeoPackage (.gpkg), Shapefile (.shp), GeoJSON (.geojson). Output format matches input format. change's tabular changelog is CSV or GeoParquet only; its spatial overlay layer supports the same four formats as the other tools.

See CONTRIBUTING.md for development setup.

Release files for topo-tools 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for topo-tools 0.6.0
File Size Uploaded
topo_tools-0.6.0.tar.gz 8.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for topo-tools 0.6.0
File Interpreter ABI Platform
topo_tools-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 MB

Release files / topo_tools-0.6.0.tar.gz

Download URL topo_tools-0.6.0.tar.gz
Size 8.3 MB
Tags Source
SHA-256 checksum
How to use checksums
39c1b0b790e1cbbce85a9d96bc9770e30b159660e5e970c4d5a3793fb77babd0
BLAKE2b-256 checksum
How to use checksums
557fc78972e5df7f11dc8fa1183c09b23f3f3818fc18be7c3073e93435c552c3
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 14, 2026.

Transparency log

Release files / topo_tools-0.6.0-py3-none-any.whl

Download URL topo_tools-0.6.0-py3-none-any.whl
Size 145.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79e8c76ffcda2aa8a92f1a75a201634a70d117015ed3701bceeff6e3f33c889f
BLAKE2b-256 checksum
How to use checksums
1079a619941aea02df46dc6437d1e791b22a0a50bfce2ffbee96fb89d3eb2db1
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 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

This release

0.6.0 This release

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page