geojson-minifier is a small utility that minifies GeoJSON files by encoding(delta and zigzag)
geometries. Depending on data, you can shrink file size up to 2-4 times, sometimes even more. Use it to speed up load time of your web application.
Either fetch source code or install with
npm install geojson-minifier
This will give you
geojson-minifier from command line passing
-p parameters(operation, input file, decimal precision).
When dealing with coordinate systems where decimal precision is important, like WGS84, use parameter
-p to specify
number of decimal places that utility should retain. The default is 0.
geojson-minifier -o pack -f <filename> -p 6
This will create minified version
<filename>.packed in the same folder as input file. To unpack use following:
geojson-minifier -o unpack -f <filename>.packed -p 6
If you want to integrate
geojson-minifier into existing application you can use 2 methods that API exposes -
var GeojsonMinifier = ;var minifier = precision: 6 ;var packed = minifier;var unpacked = minifier;