What is a .topojson file?
application/json
TopoJSON is an extension of GeoJSON that encodes topology. Shared boundaries are stored once as arcs and referenced by the geometries that use them, coordinates are quantised to an integer grid and delta-encoded, and a transform object records the scale and translation needed to recover real positions. For data with many adjacent polygons — administrative boundaries especially — files are dramatically smaller than the equivalent GeoJSON.
How to use a .topojson file
Use an example .topojson file to test TopoJSON readers and GeoJSON converters, verifying that arcs are dereferenced in the right direction, that negative arc indices are handled, and that the quantisation transform is reversed exactly.
Download example .topojson files
- Kestrel Bay Territory — Unquantized TopoJSON TwinThe territory as TopoJSON with no quantization and no transform, so arc coordinates are the raw WGS 84 positions. Decoding it must reproduce the master GeoJSON exactly — which makes it the reference case before the quantized fixtures introduce rounding.
- TopoJSON — Quantized to a 10,000-Step GridThe full territory quantized onto a 10,000-step grid with a transform block and delta-encoded arc positions — the default TopoJSON encoding. Rounding is bounded by the grid spacing, which over this 0.28-degree extent is about 2.2 m.
- TopoJSON — Coarse 100-Step Quantization (visible rounding)The same territory quantized to only 100 steps, so rounding error reaches roughly 220 m and several vertices collapse onto the same grid cell. Use it to prove that a tolerance in your comparison code is actually being applied rather than accidentally passing.
- TopoJSON — Two Parcels Sharing One ArcTwo adjacent parcels that share their common boundary as a single arc: West Field references it as 0 and East Field as ~0, the negative-index form that means traverse it backwards. Storing the boundary once is the whole point of TopoJSON, and it is also where naive decoders produce gaps or slivers.
- TopoJSON — Intentionally Invalid: Arc Referenced Without ReversalIntentionally invalid: East Field references the shared arc forwards when it should use the reversed form, so its ring no longer closes. This is the single most common hand-editing mistake in TopoJSON, and it produces a plausible-looking file that renders as a torn shape.
- TopoJSON — Three Named Objects in One TopologyOne topology carrying three separately named objects — towns, roads and areas — that all index into the same arc pool. This is how a single TopoJSON file ships what would otherwise be three layers, and readers that assume exactly one object silently show only the first.
- TopoJSON — Geometry Ids Alongside PropertiesFive town geometries that each carry both an `id` member and a `properties` object. TopoJSON keeps these separate, and converters that fold the id into properties (or drop it) break joins against an external attribute table.
- TopoJSON — Zero-Length ArcA topology whose fourth arc repeats the same position twice, giving a line of zero length. Quantization produces these routinely when two vertices land in the same grid cell, and simplification code that divides by segment length fails on them.