Closed nastasiupta closed 2 years ago
Hello @nastasiupta,
You can still create your own RouteResponse and provide it to NavigationViewController
.
@S2Ler can you be more specific please? :-? I need an example to create RouteResponse with a given array of CLLocationCoordinate2D
Use this initializer. Something like this:
RouteResponse(httpResponse: nil, identifier: nil, routes: routes, waypoints: waypoints, options: .route(options), credentials: DirectionsCredentials(accessToken: nil, host: nil))
@1ec5 but I don't have the routes objects.. I have just an array of CLLocationCoordinate2D :)
Route also has an initializer. But note that it requires a lot more information than just the coordinates, such as the text for voice instructions. Consider using the Map Matching API to convert your coordinates into a proper route. The Map Matching API also limits the number of coordinates to use. If you need more help using this workflow or need the limit to be increased, please contact the Mapbox Support team.
@nastasiupta did you (or anyone else for that matter) come up with a solution (a code example perhaps) to share? It would be really helpful - I'm facing this same limitation.
For those who come across the 25-waypoint limitation, I have made an implementation in my company's public fork of the most common react native wrapper for this repo.
Our solution was to make as many requests to the Mapbox Directions API as was needed and then combine the responses into a single route response to be passed to the MapboxNavigationService
. This could be a good start for your own solution.
the implementation is in swift; https://github.com/drive-app/react-native-mapbox-navigation/commit/80333b2048276e82ce028a2722eec63f445278e6
Mapbox Navigation SDK version
2.0.0-rc.5
Steps to reproduce
1) Create an array of coordinates (latitude, longitude) with over 100 elements. 2) Use Directions.shared.calculate & NavigationViewController to start a custom route. 3) I use Directions.shared.calculate with NavigationRouteOptions/RouteOptions and the issue as I see is that the array of locations must have maximum 25 locations or 100 locations.
Expected behavior
Before using the SDK version 2.0, I could create a Route object and setup the NavigationViewController with that Route object. But right now as I see, to init NavigationViewController I have to provide RouteResponse but as I see there is no way to use Directions.shared.calculate/Directions.shared.calculateRoute with a custom array of locations with up to 2000 coordinates.
What is the correct aproach with the SDK 2.0 for what I need :-? ?
Thanks in advice.
Actual behavior
When I want to start the navigation with an array with over 25 locations etc, but I get this error: "The operation couldn't be completed. Too many coordinates; maximum number of coordinates is 25."
there is another way that I found to set up with 100 coordinates but it's still not enough to replicate the functionality we had in the previous version.
Is this a one-time issue or a repeatable issue?
repeatable