Skip to main content

topojson

PyPI version License github actions Conda version

Encode spatial data as topology in Python!

Topojson is a library that is capable of creating a topojson encoded format of nearly any spatial object in Python.

With topojson it is possible to reduce the size of your spatial data. Mostly by orders of magnitude. It is able to do so through:

  • Eliminating redundancy through computation of a topology
  • Fixed-precision integer encoding of coordinates and
  • Simplification and quantization of arcs

See Topojson Documentation Site for all info how to use this package.

Usage

The package can be used in multiple different ways, with the main purpose to create a TopoJSON topology.

See the Python Topojson Documentation Site for all info or this Notebook with some examples, such as the following:

click to open notebook

Click on the image to go the Notebook Viewer with code-snippets how these images are created or visit the Topojson Documentation Site.

Installation

Topojson is available on PyPI and conda-forge:

pip install topojson

In a project managed with uv:

uv add topojson

Or with conda:

conda install -c conda-forge topojson

This package topojson has the following hard dependencies:

  • numpy
  • shapely

Further, optional soft dependencies are:

  • altair - enlarge the experience by visualizing your TopoJSON output
  • simplification - Visvalingam-Whyatt in toposimplify, and a quicker Douglas-Peucker that does not prevent oversimplification
  • geojson - parse string input with GeoJSON data
  • geopandas - parse your TopoJSON output directly into a GeoDataFrame
  • ipywidgets - make your life complete with the interactive experience

Other resources

For a better understanding how the different included simplification algorithms work

  • dp: Douglas–Peucker
  • vw: Visvalingam-Whyatt

You can have a look to this blog post on Line simplification algorithms. There you can find out that the epsilon value for vw is area-based and that the epsilon value for dp is distance-based.

Also, if your source projection is in meters, then it is very likely that your epsilon value should be magnitudes larger than in the examples of the documentation, where the source projection is in degrees.

There is a section on simplification in the book on 'Geocomputation with Python' that describes toposimplification as follow:

The main advantage of .toposimplify is that it is topologically “aware”: it simplifies the combined borders of the polygons (rather than each polygon on its own), thus ensuring that the overlap is maintained.

Get in touch

For now, just use the Github issues. That can be:

  • usage questions
  • bug reports
  • feature suggestions
  • or anything related

Finally, see the Python Topojson Documentation Site for all info how to use this package.

Metadata

Release files for topojson 2.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 topojson 2.0
File Size Uploaded
topojson-2.0.tar.gz 94.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for topojson 2.0
File Interpreter ABI Platform
topojson-2.0-py3-none-any.whl Python 3 none any Details

Total release size: 194.4 kB

Release files / topojson-2.0.tar.gz

Download URL topojson-2.0.tar.gz
Size 94.7 kB
Tags Source
SHA-256 checksum
How to use checksums
48725ef37746902b83e2cf49683beece05b6e9eb4fb07978560aeedd8fac6544
BLAKE2b-256 checksum
How to use checksums
7833bb8d17c3242217de9141c80eda16f9db090f8c7887cf225ad9fcc63b78c1
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 Oct 4, 2026.

Transparency log

Release files / topojson-2.0-py3-none-any.whl

Download URL topojson-2.0-py3-none-any.whl
Size 99.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74b27bb5bc32c5bc01b3dce32f74a325d21d2db11682e518fa96d87f6aa9f42a
BLAKE2b-256 checksum
How to use checksums
ca03657a54720fd7b61dae639ab30bcab06e10d08900012902cbe58964fbdd40
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 Oct 4, 2026.

Transparency log
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