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 thirteen 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.
  • dissolve: aggregates a polygon layer into a coarser one by grouping on attribute columns and unioning geometry per group.

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.5.6

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.5.6
File Size Uploaded
topo_tools-0.5.6.tar.gz 8.2 MB Details

Built distribution (wheel)

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

Total release size: 8.3 MB

Release files / topo_tools-0.5.6.tar.gz

Download URL topo_tools-0.5.6.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
ca0694259f8fe9a691b5b4abc889a323ea71afd4c54b1ead5a887b89ab9d8167
BLAKE2b-256 checksum
How to use checksums
31eaced6cef9d59834edc6103dd33c1a0907608de54441852299faa6a352647c
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 1, 2026.

Transparency log

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

Download URL topo_tools-0.5.6-py3-none-any.whl
Size 122.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
728ce215ec142815729f3bd834b805295d94496653cbd09596ead876f5a51730
BLAKE2b-256 checksum
How to use checksums
3e06e31be0f6935502af03bd8bb70857f5e64abb593aabf5e0e3a9968fd99b45
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 1, 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

0.6.0

2 release files

This release

0.5.6 This release

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