DevTools Logo

GeoJSON to TopoJSON & WKT Converter

GeoJSON to TopoJSON & WKT Converter

Convert GeoJSON into compact TopoJSON or standard WKT. Coordinates stay in longitude, latitude order.

Runs in your browser
0 keeps exact coordinates. 2 or more snaps to a grid.
Try an example

GeoJSON

18 lines · 265 chars

TopoJSON

27 lines · 380 chars · bbox [29,41,29,41]

Examples

Point round-trip plus WKT

Input
convertGeoJsonJson('{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[10,20]}}]}')
Output
{ wkt: "Feature 1: POINT (10 20)", bbox: [10, 20, 10, 20] }

The point survives topology conversion exactly and renders as WKT with its bbox.

Quantized polygon

Input
convertGeoJsonJson(polygonRaw, 1000).topology
Output
{ transform present, round-trip error < 0.01 }

Quantization adds a topology transform while keeping coordinates within tolerance.

About this tool

GeoJSON TopoJSON Converter bridges formats with convertGeoJson(collection, quantization = 0) and convertGeoJsonJson(raw, quantization): parseGeoJson validates a FeatureCollection, topojson-server builds the Topology, and topojson-client converts it back to a FeatureCollection for round-trip checks.

Each conversion returns { topology, feature, wkt, bbox }: WKT renders Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection with Feature N: prefixes, while bbox is the [minX, minY, maxX, maxY] sweep over every finite coordinate.

Quantization is strict and deterministic: 0 means no transform, values below 2 throw, and N >= 2 emits a quantized transform that bounds round-trip error — identical inputs always produce identical TopoJSON strings via formatGeoJsonResult.

How to use this tool

  1. Paste GeoJSON

    Provide a FeatureCollection string or object with valid feature geometries.

  2. Set quantization

    Keep 0 for exact arcs or pass an integer >= 2 for smaller topology output.

  3. Verify round-trip

    Compare topologyToFeature output coordinates and the WKT plus bbox summary.

Use cases

Shrinking map payloads

Quantize shared arcs before serving TopoJSON to web maps.

Validating imports

Catch non-JSON, non-FeatureCollection, and bad-geometry uploads with explicit errors.

Previewing geometry

Read WKT lines and bbox extents without opening a GIS client.

Common mistakes

Mistake:Passing quantization 1 for light compression.

Fix:Only 0 or integers >= 2 are valid — 1 throws a quantization error by design.

Mistake:Expecting quantized coordinates to match exactly.

Fix:Quantization rounds positions, so assert within tolerance instead of deep equality.

Mistake:Feeding a bare Feature or Geometry.

Fix:The converter requires a FeatureCollection with a features array — wrap single features first.

Frequently asked questions

What does this tool do?

It converts a FeatureCollection with convertGeoJsonJson into TopoJSON via topojson-server, converts back with topojson-client, and reports WKT plus a [minX, minY, maxX, maxY] bbox.

How does quantization affect output?

Quantization 0 keeps exact arcs with no transform, integers >= 2 add a transform that bounds round-trip error, and 1 or negative values throw a quantization error.

Is my map data uploaded or stored?

No. Validation, topology building, WKT rendering, and bbox math run entirely in your browser.

Why a FeatureCollection or JSON error?

Only valid JSON FeatureCollection objects with a features array convert — bare Features and malformed JSON throw before any topology work.

References & standards