twpayne / go-geom

Package geom implements efficient geometry types for geospatial applications.
BSD 2-Clause "Simplified" License
841 stars 104 forks source link

encoding/geojson: support maxDecimalDigits #168

Closed otan closed 4 years ago

otan commented 4 years ago

Add support for maximum decimal digits being output in a GeoJSON. This involved some trickery with implementing MarshalJSON on a slice of coords that could be []float64, [][]float64 or [][][]float64. This logic is also applied to the bounding box object if desired.

Also fix the encode bbox option to automatically figure out the bounds from the provided geom.T object.

I notice there has been no release tag yet so this should be safe to go into the wild.

twpayne commented 4 years ago

Thanks! Merged and tagged a new version (v1.2.0).