Skip to content

GeoJSON Optimizer

Reduce coordinate precision. Simplify geometry. Drop unused properties. Minify. Every step reports what it saved as it runs.

Skip to the tool

Four things make a GeoJSON file large, and they are worth very different amounts. This runs all four and reports what each one saved, as a running total, so you can see which step is doing the work on your own data.

Coordinate precision is usually the quiet one. Exports routinely carry fifteen decimal places, which is a resolution of nanometres for data that was surveyed in metres. Simplification is usually the largest, and the only one that changes the shape, which is why the original stays on the map in grey behind the result.

Minifying is the step that flatters itself. Stripping indentation can halve the byte count of a pretty-printed file, and almost all of that saving disappears once your server compresses the response. The measurements here are taken on the minified document for that reason, so the other three steps are not credited with removing whitespace. There is a worked example on the file size guide, run against a real dataset from end to end.

What each step does

The four steps run in a fixed order. The order changes the numbers along the way and leaves the end result the same. Properties go first, because there is no point simplifying geometry attached to fields you are about to drop. Simplification goes second, so precision rounding runs over fewer positions. Precision goes last. Minification is not a step at all, for the reason below.

Coordinate precision

Rounds every coordinate to a fixed number of decimal places. Six places is about eleven centimetres at the equator, which is finer than almost any source data deserves. Exports from desktop GIS routinely carry fifteen.

Each decimal place you drop removes one character per coordinate, so the saving scales with position count. Rounding cannot unclose a ring, because identical inputs round to identical outputs, but it can collapse a very small shape into repeated positions. Check the map before you ship the result.

Simplification

Runs Ramer-Douglas-Peucker through Turf at the tolerance you set, measured in coordinate degrees. This is the only step that changes the shape of your data, and usually the one that saves the most. The original outline stays on the map in grey so you can see what a given tolerance threw away.

Each geometry is simplified on its own. Where two polygons share a border, that border is simplified twice and can come apart, leaving slivers and gaps. If shared edges matter, TopoJSON is the format built to preserve them.

Properties

Keeps only the property names you list and drops the rest. The saving scales with the number of features, not the number of properties, so it is large on a file of twenty thousand points and small on a file of two hundred countries. The tool reports how many names survived so you can tell which case you are in.

Minification

Writes the output without indentation. This is the step people expect the most from and should expect the least from. Stripping whitespace from a pretty-printed file can cut it by half, and then compression recovers most of that saving anyway, so the benefit over an already-compressed response is small.

Every measurement here is taken on the minified document for that reason. Comparing a minified result against pretty-printed input would credit the other three steps with removing whitespace they never touched.

A worked example

The file size guide runs this same sequence over Natural Earth's 1:10m world country boundaries, a real public-domain dataset with 258 features and more than half a million positions, and publishes what each step saved. Every figure on that page came from running this code, and the dataset is linked so you can repeat it.

Use it to calibrate. If your data looks like that one, the guide tells you which step is worth your time before you start.

What this tool does not do

  • It does not convert to another format. Where a format change is the right answer, the format comparison covers it.
  • It does not preserve topology. See the note under simplification above.
  • It does not compress. Compression is your server's job, and it is the single largest saving available. Turn on gzip or Brotli before optimising anything.
  • It does not round property values, only coordinates. A property carrying a fifteen-decimal number keeps it.