Install & Compatibility
Where this runs
tested against v1.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✓ 4.9s
102MB installed
● package 102MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Topology
✓ from topojson import Topology
topojson
✓ import topojson
✗ from topojson import *
Wildcard imports not recommended; use explicit imports.
Creates a Topology from a GeoJSON dict and outputs TopoJSON string.
from topojson import Topology
import geopandas as gpd
# Load a GeoJSON or Shapefile into a GeoDataFrame
# Example: gdf = gpd.read_file('path/to/file.geojson')
# Or use built-in example
data = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'properties': {},
'geometry': {
'type': 'Polygon',
'coordinates': [[[0,0],[1,0],[1,1],[0,1],[0,0]]]
}
}
]
}
topo = Topology(data, prequantize=False)
topojson_str = topo.to_json()
print(topojson_str[:200])
Errors
Common errors & fixes
TypeError: __init__() got an unexpected keyword argument 'ignore_index'
Using `ignore_index` parameter with topojson version <1.9.
fixUpgrade topojson: `pip install --upgrade topojson`
ValueError: Input data must be a dict with 'type' and 'features' keys or a GeoDataFrame
Passing an unsupported data format (e.g., plain list of coordinates).
fixWrap input in a GeoJSON FeatureCollection dict or use a GeoDataFrame.
AttributeError: module 'topojson' has no attribute 'Topology'
Importing incorrectly (e.g., `import topojson` then using `topojson.Topology` but the module may not expose the class directly in old versions).
fixUse `from topojson import Topology`.
Upgrade
Version history
1.10latest on PyPI · released Jul 22, 2025
Audit
Dependencies
numpyrequiredArray computations
shapelyrequiredGeometry operations
pandasrequiredDataFrame handling
geopandasoptionalGeoDataFrame input/output
fionaoptionalShapefile reading
simplejsonoptionalJSON serialization