mapbox / mapbox/mapbox-directions-swift
Match.tracepoints is inaccurate when there are submatches
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 206
- Forks
- 99
- Avg merge
- 7h 54m
- Merged PRs (30d)
- 3
Description
When none of the input coordinates in MatchOptions separates legs, and the Map Matching API isn’t confident about a match between two input coordinates, it terminates one match at the first input coordinate, adds multiple “submatches” to the next input coordinate, and finally adds a match from that input coordinate onward.
This library gained Map Matching API compatibility to support a “Bring Your Own Route” workflow in which the API’s response is converted into Route objects, as if it came from the Directions API. The assumption is that each match spans the entire distance between the first and last input coordinates, but that isn’t necessarily what the API returns. If the API returns submatches, every Match object’s tracepoints property is inaccurate and there’s no way to reconstruct what the tracepoints should be.
Each match’s array of tracepoints should be filtered down to just the tracepoints whose matchings_index corresponds to the match. It may also help to assert that the waypoint_index increases monotonically.
/cc @mapbox/navigation-ios
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 with Sources/MapboxDirections/Match/MBMatchOptions.swift, especially the linked MatchOptions handling for Map Matching responses. Trace how submatches and tracepoints are assigned, then ensure each Match receives only tracepoints with its matching_index and verify waypoint_index ordering is monotonic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100