Open ffflabs opened 6 years ago
👍 Very cool!
Instead of a creating an entirely new module, couldn't we just add algorithm
as an optional parameter in options
which would default to douglas-peucker
. That way the user can easily toggle back and forth by simply changing one parameter.
Yeah, that would be the sanest approach, since turf.simplify
already does geometry decomposition to apply the simplification to the underlying rings/arcs of geometries you feed it.
👍 Sounds like a good idea! Looking forward to seeing this implemented 😄
I've used a VW library in the past with python with great results. And love the approach of including it via the existing module via the options (one of the great benefits of going to this module approach)
I've just seen that jsts
does have both Algorithms in its simplify
operation. I'll check if their weight adds too much overhead to the @turf/simplify
build (as in, if I bundle simplify-js
vs if I bundle jsts-es/simplify
.
👍 Almost done refactoring jsts
to ES6 (both versions of jsts
& jsts-es
has major issues with extend.js
& inherits.js
)
Follow progress here: https://github.com/DenisCarriere/turf-jsts
Ideal goal would be to merge this directly into jsts
(100% refactored/linted code... 🐵)
@amenadiel I'll check if their weight adds too much overhead to the
@turf/simplify
build
I'm 👍 for adding these algorithms using jsts
now that it's a bit more stable and will soon be able to handle proper Rollup Tree shaking, the next release will be significantly smaller in bundle size (don't know the exact %).
I know
turf.simplify
usessimplify-js
under the cover, which in turn uses Douglas-Peucker simplification algorithm.Inspired by the approach taken by Matt Bloch (author of MapShaper) I made a little proof of concept for a simplification approach using Visvalingam Whyatt algorithm (as explained in this Mike Bostock's article)
You can compare the outcome of both simplification algorithms in https://huasofoundries.github.io/simplify-vw/
I'm using the latests unpkg available package of turf.
I guess both approaches have their own pros and cons. If you guys are interested, I could put a little effort to make this POC work for Polylines and Multigeometries.