-
Notifications
You must be signed in to change notification settings - Fork 352
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
Compatibility with Mapbox Optimization API #534
base: master
Are you sure you want to change the base?
Conversation
Using the argument routingOptions. A "default" key will result as the parameter not being added at all on the query string, otherwise, if a boolean is provided, it will be appended with the corresponding key.
Mapbox optimization route returns trips instead of routes
Hi. Any updates on this? have the same mistake and don't want to change source code. What do I do? |
Yeah - same here. I'd like to get some cycle routes onto the maps .... |
@perliedman It's been a year since I've PR this, any plan to merge it? |
route = this._convertRoute(response.routes[i]); | ||
//Mapbox optimization route returns trips instead of routes | ||
let routes = response.routes || response.trips; | ||
for (i = 0; i < routes.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some indentation mistake here, perhaps spaces/tabs getting mixed up?
var locs = [], | ||
hints = [], | ||
wp, | ||
latLng, | ||
computeInstructions, | ||
computeAlternative = true; | ||
computeInstructions = options.steps && options.steps !== "default" ? true : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this new "default"
mean? How is it intended to be used?
@Bigood yeah sorry about that, I don't use LRM for anything myself these days, so it's hard to find the time/energy to work on it, and easy to miss issues and PRs. This looks good as far as I can tell, with some minor comments I made to the code. Haven't actually tested the code, but I assume you have tested it still works with "normal" routing as well as with the optimization API? |
Thanks for taking the time to review this! I'll test it again with the most recent API, double check my code, and probably correct some bits. |
Original issue
Passing
alternative=(true|false)
to the Mapbox Optimization API resulted as a bad request, I needed to have the option to remove the query parameter. While looking at the code, I changed a few things to be able to remove steps and pass the roundtrip parameter to the API.Reference : https://docs.mapbox.com/api/navigation/#optimization
Usecase
Changes
Mainly on osrm-v1.js, to be compatible Mapbox Optimization API, see attached commits.