-
Notifications
You must be signed in to change notification settings - Fork 314
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
allow custom OSRM servers #46
Comments
Exactly the feature i'm looking for. |
MapboxNavigation.swift doesn't deal with API responses directly; it uses Route objects that MapboxDirections.swift creates from the API response. MapboxDirections.swift has methods to produce Route objects from JSON (deserialized as Foundation objects). My understanding is that the OSRM v5 and Directions API v5 responses are already very similar, so an OSRM response wouldn't need to be modified heavily before being passed into those JSON-based initializers. Still, I agree that it would be nice for MapboxDirections.swift to have built-in support for OSRM v5 alongside the existing support for Directions API v4 and v5: mapbox/mapbox-directions-swift#121. Closing, because there won't be anything to modify in this project once MapboxDirections.swift gains OSRM support. |
so whats the conclusion? |
It’s already possible to use this library with a custom OSRM server, as long as you pass the right JSON structure into This ticket is closed because MapboxNavigation and MapboxCoreNavigation use the Route object created by MapboxDirections.swift, regardless of the server endpoint that provided the underlying data. |
will try it out! thanks pal! |
Has anyone managed to connect to your own OSRM server and modify your own JSON response structure? 1ec5 mentioned mapbox/mapbox-directions-swift#121 "which would simplify this step so that you’d be able to pass in an unmodified OSRM response". Apparently that post doesn't have much information to go about doing it |
Since MapboxDirections.swift currently only knows how to issue requests to the Mapbox Directions API, you’ll need to write your own code to construct the request URL to your OSRM server and send a request using URLRequest (in Swift) or NSURLRequest (in Objective-C). Then, use JSONSerialization/NSJSONSerialization to turn the response data into a Dictionary/NSDictionary before passing it to the Route initializer. You’ll want to compare the OSRM response format with the Mapbox Directions API response format. Modify the dictionary representation of the response data to match the Directions API format. They already look very similar; I couldn’t spot any differences at a glance. |
Any news on this particular issue? |
Any update? |
many users of OSRM run their own OSRM servers. it would make MapboxNavigation.swift more useful if it's easy to connect to your own OSRM server.
a problem is that the mapbox directions API does not return raw OSRM responses, but use a node app to modify/amend it before returning it. either the expected format should be documented or the code used to modify the OSRM response should be open sourced.
The text was updated successfully, but these errors were encountered: