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

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

Built distribution (wheel)

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

Total release size: 8.3 MB

Release files / topo_tools-0.5.4.tar.gz

Download URL topo_tools-0.5.4.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
33768a761cb91f66c34b83588bb127bfa2b628bcbe5ac6840d81b6025130a6d6
BLAKE2b-256 checksum
How to use checksums
35c1aa8edffd7e42a111c9bd0e530f8a185278f23c968858a649974b90331f4b
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 28, 2026.

Transparency log

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

Download URL topo_tools-0.5.4-py3-none-any.whl
Size 120.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
012bb6a4bb9b65755e390bd1f80006545e97e0e3d9f95cb9bf48f46c329b10f5
BLAKE2b-256 checksum
How to use checksums
d568ae95cf9b01b202d0d6e7be0d402cefeefa2521ef2796e7846f3f466d457b
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 28, 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

0.5.5

2 release files

This release

0.5.4 This release

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