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

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

Built distribution (wheel)

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

Total release size: 8.3 MB

Release files / topo_tools-0.5.5.tar.gz

Download URL topo_tools-0.5.5.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
861c5577712568922732fd178d46e2d48833a65b7e5858000491211936960371
BLAKE2b-256 checksum
How to use checksums
adb9dac8a22e7fde1a6637a13761f2d7c7f2c4d567ba5d05f9563086edd7a50a
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 Aug 31, 2026.

Transparency log

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

Download URL topo_tools-0.5.5-py3-none-any.whl
Size 122.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52b6974c7363d015a0ea9577fe62f700abfbca5b5fee5ef06766dcac0d82be00
BLAKE2b-256 checksum
How to use checksums
02bacc0f0bd8e04e10eb3c51f4cb44b3a0c6526e0262cd8ffe8cfc33a8136604
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 Aug 31, 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

0.5.6

2 release files

This release

0.5.5 This release

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