Closed simonw closed 3 years ago
GeoJSON can get big. It would be neat if this library could simplify giant GeoJSON shapes before attempting to render them.
Leaflet ships with a simplify() helper function: https://leafletjs.com/reference-1.3.0.html#lineutil-simplify
simplify()
Also available as a separate library (with a really nice interactive demo): http://mourner.github.io/simplify-js/
Turf has a version of this that can be applied to GeoJSON documents directly: http://turfjs.org/docs/#simplify
The tricky part is picking the right tolerance value.
I'm happy with the simpler fix I implemented in #11 which reduces floating point accuracy.
GeoJSON can get big. It would be neat if this library could simplify giant GeoJSON shapes before attempting to render them.
Leaflet ships with a
simplify()
helper function: https://leafletjs.com/reference-1.3.0.html#lineutil-simplifyAlso available as a separate library (with a really nice interactive demo): http://mourner.github.io/simplify-js/
Turf has a version of this that can be applied to GeoJSON documents directly: http://turfjs.org/docs/#simplify
The tricky part is picking the right tolerance value.