Port geosimplify-js
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 271
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
[`LineString.simplify(tolerance:highestQuality:)`](https://mapbox.github.io/turf-swift/2.3.0/Structs/LineString.html#/s:4Turf10LineStringV8simplify9tolerance14highestQualityySd_SbtF) and [`simplified(tolerance:highQuality:)`](https://mapbox.github.io/turf-swift/2.3.0/Structs/LineString.html#/s:4Turf10LineStringV10simplified9tolerance14highestQualityACSd_SbtF) are based on [simplify-js](https://github.com/mourner/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: https://github.com/mapbox/mapbox-directions-swift/issues/661#issuecomment-1063184448. 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](https://github.com/mapbox/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:
```swift
mutating func simplify(minimumOffset: LocationDistance, minimumGap: LocationDistance)
func simplified(minimumOffset: LocationDistance, minimumGap: LocationDistance)
```
/cc @danpat @Guardiola31337
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing LineString.simplify and simplified methods, then compare their behavior with the linked geosimplify-js project and the map-matching context. Done means adding the suggested Swift methods with minimumOffset and minimumGap that preserve points along straightaways.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100