mapbox / mapbox/mapbox-directions-swift
Initial point from the response is different than first from waypoint
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 206
- Forks
- 99
- Avg merge
- 7h 54m
- Merged PRs (30d)
- 3
Description
**Steps to reproduce:**
```
let coordinates = [
CLLocationCoordinate2D(latitude : 32.892264999999995, longitude : 13.177763000000002),
CLLocationCoordinate2D(latitude : 32.89241945002732, longitude : 13.177979323297292),
CLLocationCoordinate2D(latitude : 32.89113899999998, longitude : 13.208977000000008)
]
let waypoints = coordinates.map { Waypoint(coordinate: $0, coordinateAccuracy: -1) }
let options = NavigationRouteOptions(waypoints: waypoints, profileIdentifier: .walking)
Directions.calculate(options) { _, routes, error in
let route = routes.first // api returns only one route
print(route.coordinates)
}
```
**Expected behavior**
First point from returned route is first coordinate.
**Actual behavior**
First point from returned route is second coordinate.
```
▿ 0 : CLLocationCoordinate2D
- latitude : 32.893127
- longitude : 13.178129
▿ 1 : CLLocationCoordinate2D // I assume that some interpolation is done here
- latitude : 32.892265
- longitude : 13.177763
▿ 2 : CLLocationCoordinate2D
- latitude : 32.892295000000004
- longitude : 13.177812000000001
▿ 3 : CLLocationCoordinate2D
- latitude : 32.892314000000006
- longitude : 13.177851
▿ 4 : CLLocationCoordinate2D
- latitude : 32.89238700000001
- longitude : 13.178065
▿ 5 : CLLocationCoordinate2D
- latitude : 32.89241400000001
- longitude : 13.178136
(...)
```
**Configuration**
Mapbox-iOS-SDK: 5.4.0
Mapbox Navigation 0.38.1
iOS versions: 13.3
Device/simulator models: all
Xcode version: 11.3
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
Reproduce the issue with the shown CLLocationCoordinate2D values, Waypoint setup, NavigationRouteOptions, and Directions.calculate call. Inspect how route.coordinates is produced and how the initial waypoint is handled. Done means the returned route begins with the first coordinate and the behavior is covered by a regression check.
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
- 35/100