Making GeoJSON smaller

If you just exported some GeoJSON that used to be a shapefile, your GeoJSON might be like a gazillion MB now. There are two major things you can try

  1. Simplifying geometries sacrifices the fidelity of the map to get a smaller filesize. If you have a high-quality map of a large area that you aren’t zooming in on, this is a good idea.
  2. Removing unused data columns is a fantastic way to get filesize down if the dataset includes columns you don’t need/use.

I’d honestly try removing unused data columns first, simplifying geometries can get messy.

You should also check out topojson, which is practically industry-standard with d3 these days. Topojson takes GeoJSON and can make it 50-80% smaller!

Simplifying the geometries

First, use the magnifying glass with the + on it to zoom in so you can see your polygons up close. If we screw them up we need to know!

Zoom

You’ll want to use the top menu and select Vector > Geometry Tools > Simplify Geometries.

Simplify geometries

Now try saving it again! The big issue you’ll probably end up with is county/state/census tract/etc boundaries not quite lining up any more, which is why I recommend removing attributes first.

Removing attributes

This is the thing that really seems to work for me - getting rid of data you just don’t need. GeoJSON stores data in a terribly long-winded way, so every additional column that you have is tons of extra space wasted.

First, get into the nuts and bolts of the layer by right-clicking it and selecting Properties.

Right click, properties

Then select Fields from the left-hand side. We’re going to want to edit those fields, so you’ll also want to turn on edit mode by clicking the little pencil icon.

Fields + edit mode

Select the columns you don’t need (Control + click for multiples, or Shift + click for many in a row) and then click the Delete column button.

Deleting column

For my project I was only going to use the year the building was built (YearBuilt), so I was able to remove dozens of columns, and really get my filesize down.

Remaining

Now you can do the right-click, Save As... from above and save your brand-new, super-small file!

Want to hear when I release new things?
My infrequent and sporadic newsletter can help with that.