Open gka opened 10 years ago
thanks! I saw mapshaper when I was searching for existing geojson CLI simplifiers but it has a lot of surface area and I didn't realize it did this already. It's unfortunate that both of the examples you linked two aren't themselves standalone modules though
now theres a single override point for plugging in other simplification algorithms: https://github.com/maxogden/simplify-geojson/blob/master/index.js#L10-L12
What I have now suits my use case fine (simplifying linestrings from GPS data loggers), so if someone else has an e.g. polygon use-case where topojson's simplification is noticeably better then I'm happy to take a PR that plugs it in, but it'd have to be a module that just does simplification and not a coarse grained dependency e.g. all of topojson
Yes, I agree that the mapshaper-cli should ideally be separated from the gui stuff (cc @mbloch).
Here is a reference implementation in JavaScript:
https://github.com/mbostock/topojson/blob/master/lib/topojson/simplify.js
And another:
https://github.com/mbloch/mapshaper/blob/master/src/mapshaper-simplify.js
Btw, mapshaper allows GeoJSON simplification via command line.