mapbox/turf-swift

Port geosimplify-js

1ec5 opened this issue · 1 comments

1ec5 commented

LineString.simplify(tolerance:highestQuality:) and simplified(tolerance:highQuality:) are based on simplify-js, which is fine for certain simplification use cases. However, sampling the input to a map matching algorithm requires interpolating points along a straightaway: mapbox/mapbox-directions-swift#661 (comment). The standard Ramer–Douglas–Peucker algorithm can easily create a space between vertices large enough to result in a gap according to the map matching algorithm.

geosimplify-js is a derivative of simplify-js that preserves points along straightaways. It could be ported to Swift as an alternative to the usual simplification algorithm. Suggested method signatures:

mutating func simplify(minimumOffset: LocationDistance, minimumGap: LocationDistance)
func simplified(minimumOffset: LocationDistance, minimumGap: LocationDistance)

/cc @danpat @Guardiola31337

Tagging @mapbox/navigation-android for parity.