-
Notifications
You must be signed in to change notification settings - Fork 124
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
Drop shortest distance calc for waypoints and manage their position in the query by route segments #2
Comments
Why does this calculate client-side anyway? We just launched an API for this. |
I'm confused as to why this is necessary at all. mapbox-directions.js doesn't need it. |
Same |
It's calculated to derive the URL query. Given a url like:
It sorts the coordinates between the first(origin) + last(destination). If it's not sorted, the route is returned with the coordinates in the order that they were sent and not - as I could tell - sorted by the most optimized path. |
Yes, and the user inputs waypoints in order, and gets directions in order. This is a directions API, not a traveling-salesman API, and the assumption is that you would want to go to things in the order you type them, rather than an 'optimal' order - people do not plan, for example, roadtrips, based on algorithms. |
Let me be a little more specific. Say I have a route planned with a single waypoint: Origin = A If I wanted to add another waypoint (D) before the first waypoint I, (as the user) would expect the route to order in this sequence: A -> D -> C -> B. If I don't sort the order the sequence looks like this: A -> C -> D -> B. which is not the result I would expect. |
You create new waypoints when someone clicks a segment. You would check which segment they clicked to create the waypoint, and place the new waypoint in between its end points. |
Ah that makes sense. I'm creating the directions route as a single LineString when it should be broken into segments. |
💀 going to avoid doing anything weird with waypoint ordering all together. |
Instructions for all legs
It's otherwise a performance kill calculating the shortest distance between them
The text was updated successfully, but these errors were encountered: