8

For my project I am trying to convert the tiger shapefile information for us states into GeoJSON format

However when I use the ogr2ogr tool the data file is about 20 MB. I have seen the geoJSON file of US States elsewhere of around 88KB.

How do I reduce the output to geoJSON file?

7

You have two ways of reducing the file size:

  1. Remove all the pretty formatting and redundant white space. In some 'XML-style' files this can be a surprisingly large amount and can easily double or even treble your file size. However I doubt it accounts for the difference in your volume and the data you link to above.
  2. Reduce the volume of actual data either by reducing your coordinate precision (e.g. 6 decimal places vs say 12) and/or reducing the actual number of vertices representing the features in your data. I suspect that this accounts for a substantial proportion of the difference in file sizes you are seeing. Much depends on your use-case for how much simplification will be acceptable and only you can decide that.
2

Removing properties and simplifying lines are the easiest ways if you want just GeoJSON, TopoJson an modified version of GeoJson and can get some very small sized files especially if you keep it projected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.