Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial point from the response is different than first from waypoint #407

Open
twprzybysz opened this issue Jan 30, 2020 · 4 comments
Open
Labels
blocked Blocked by dependency or unclarity.

Comments

@twprzybysz
Copy link

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

@1ec5
Copy link
Contributor

1ec5 commented Feb 6, 2020

I assume that some interpolation is done here

As long as options.routeShapeResolution is full (which is the default), route.coordinates should contain many more coordinates than the coordinates that you converted into waypoints. Waypoints are the locations you know in advance that you want the user to visit, whereas route.coordinates contains enough coordinates for you to know how the user will need to travel to get from one waypoint to the next.

In general, the additional coordinates aren’t due to interpolation; rather, each coordinate is supposed to correspond to a node along a way in OpenStreetMap. OSM may insert a node for many reasons, not necessarily due to the road’s geometry.

However, the Directions API doesn’t appear to be returning the expected results in this area. The first two waypoints are very close to each other and should get snapped to different points along Via Cosenza. Here’s how the OSRM-powered FOSSGIS Routing Service routes between the first two waypoints:

osrm

By contrast, this request returns an unexpected geometry that starts with a spurious coordinate corresponding to the end of Via Cosenza:

valhalla

The mapbox/driving profile returns the same result as OSRM, but the mapbox/cycling profile returns a zero-length geometry at the destination waypoint.

/cc @mapbox/directions-traffic-and-data

@1ec5 1ec5 added the blocked Blocked by dependency or unclarity. label Feb 6, 2020
@twprzybysz
Copy link
Author

@1ec5 any update on this?

@1ec5
Copy link
Contributor

1ec5 commented Feb 22, 2020

I’ve reported the issue to the backend routing team to investigate the issue. Unfortunately, there’s nothing we can do on the client side to work around the issue.

Do you see a similar issue with other roads in Tripoli, or just this particular road?

@twprzybysz
Copy link
Author

@1ec5 so far only this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by dependency or unclarity.
Projects
None yet
Development

No branches or pull requests

2 participants