GeoJSON coordinate precision
Twelve decimal places is nanometre precision, and it is in a lot of exported GeoJSON. Round the coordinates to something sane, drop altitude values, remove repeated points, and watch the byte count fall — the status line reports the saving.
GeoJSON coordinate precision
What this tool does
It rewrites every coordinate to a fixed number of decimal places, which is the cheapest meaningful way to shrink a GeoJSON file — no shape is changed beyond the rounding itself, so unlike simplification it never removes a vertex that matters. Optionally it also drops third (altitude) ordinates and collapses consecutive duplicate positions, which exports full of stationary GPS fixes accumulate.
The intent it closes: "this file is far bigger than the map needs." A decimal place is worth knowing: at the equator, 6 decimals is about 11 cm, 5 is 1.1 m, 4 is 11 m, 3 is 110 m. Web maps rarely need more than 6, and a country-level choropleth is fine at 4.
How this tool works
A single pass over every position.
1. Round
Each position's X and Y are rounded to the chosen number of decimals using ordinary half-up rounding. With drop Z off, a third ordinate is kept and rounded too; with it on, positions come out strictly two-dimensional.
2. Remove repeated points
After rounding, consecutive identical positions are collapsed — rounding itself creates these, which is why the step runs second. Polygon rings are then re-closed if the collapse removed their closing point, so the output stays valid: a ring must start and end at the same position.
3. Report the saving
Input and output are both measured as UTF-8 bytes and the difference reported as a percentage, along with how many duplicate points were removed. Ticking minify strips the JSON whitespace as well, which on a coordinate-heavy file is usually another 15–25%.
Options
Decimals
The precision that matters for your use: 6 for street-level web maps, 5 for anything at city scale, 4 for regional choropleths, 3 for a world overview. Going below 3 starts to visibly deform small shapes.
drop Z / altitude
RFC 7946 allows a third ordinate, and most web renderers ignore it while still paying for the bytes. Dropping it is usually free size; keep it if your consumer reads elevation.
remove repeated points / minify
De-duplication is safe — a repeated position carries no information — and rings are re-closed afterwards. Minifying is purely cosmetic for machines and unreadable for humans, so leave it off while you are still working on the file.
Example
Input:
{ "type": "LineString", "coordinates": [
[-122.4194155341, 37.7749295364, 12.5],
[-122.4194155399, 37.7749295401, 12.6],
[-122.4083, 37.7833, 10]
] }
Output (4 decimals, drop Z, de-duplicate):
{
"type": "FeatureCollection",
"features": [
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString",
"coordinates": [[-122.4194, 37.7749], [-122.4083, 37.7833]] } }
]
}
The first two positions rounded to the same coordinate — 4 decimals is about 11 m and they were 6 mm apart — so one was removed as a duplicate. The altitude values went with drop Z.
Tips & common pitfalls
- Rounding is not simplification. This keeps every vertex and shortens its numbers; simplify removes vertices while keeping the shape. Do both, in that order, for the biggest saving.
- Shared borders can develop slivers. Two adjacent polygons rounded independently may no longer match exactly. For topology-preserving reduction, TopoJSON is the right tool.
- The output is always a FeatureCollection. A bare geometry input is wrapped in a feature, which is what most consumers want anyway.
- Check the report, not just the file. If the saving is small, the size is in the properties, not the coordinates — stats will show which.
FAQ
How many decimals do I actually need?
At the equator: 6 ≈ 11 cm, 5 ≈ 1.1 m, 4 ≈ 11 m, 3 ≈ 110 m. Pick the one just finer than what your zoom level can show — 6 for street-level, 4 for a regional map.
Will it change my shapes?
Only by the rounding itself, plus removing positions that rounded to be identical. No vertex that still differs from its neighbour is ever dropped.
Why did a polygon ring stay closed?
Because closing points are restored after de-duplication. A ring whose last position collapsed into the first gets the first position appended again, keeping the geometry valid.
Does it preserve properties?
Yes, untouched. Only coordinates change.