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.7.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.7.0
File Size Uploaded
topo_tools-0.7.0.tar.gz 8.3 MB Details

Built distribution (wheel)

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

Total release size: 8.5 MB

Release files / topo_tools-0.7.0.tar.gz

Download URL topo_tools-0.7.0.tar.gz
Size 8.3 MB
Tags Source
SHA-256 checksum
How to use checksums
025fde5a35fde8ba216fd7eb5131364862d9d892dca4b307f24c80f2a0bbe60f
BLAKE2b-256 checksum
How to use checksums
7908d7bfb33b4410a5e2f25c461d2378a243387b3960a5f744fc65c5a17caf38
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 17, 2026.

Transparency log

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

Download URL topo_tools-0.7.0-py3-none-any.whl
Size 169.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e977819821a7fd41cc03de4fb912ddf7907015555e6b3dbd4a3f436f791cbd4b
BLAKE2b-256 checksum
How to use checksums
f73c72ea35c18aaedc69ed1bb643438b054ba67196e11cf78b4d36c962f1a03b
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 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.2

2 release files

0.7.1

2 release files

This release

0.7.0 This release

2 release files

0.6.0

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