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

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.1
File Size Uploaded
topojson-2.1.tar.gz 99.9 kB Details

Built distribution (wheel)

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

Total release size: 204.6 kB

Release files / topojson-2.1.tar.gz

Download URL topojson-2.1.tar.gz
Size 99.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee4d197d96775321de4c5e7f29cbf0d06829de672b9f3387b3e775dd1982057a
BLAKE2b-256 checksum
How to use checksums
0d58e3524df5df9af2af700a8ad9a0c124a61a7ec6592bc36b9dabcb730294f0
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.1-py3-none-any.whl

Download URL topojson-2.1-py3-none-any.whl
Size 104.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40b9f9e4b7c3934cef7d1463f9b63cb53dd5ba6308779d348130faf9dc502fd4
BLAKE2b-256 checksum
How to use checksums
92ccc3a28bc0e6a11bc294bd00852ed0ad37be11702c0fe3195acb3a9c6eaaab
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