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

Multiple waypoints in /route returns unwanted loops #5873

Closed
siljuovix opened this issue Oct 30, 2020 · 2 comments
Closed

Multiple waypoints in /route returns unwanted loops #5873

siljuovix opened this issue Oct 30, 2020 · 2 comments

Comments

@siljuovix
Copy link

Hi!

I am using OSRM built locally. When requesting a route using a pair of origin and destination coordinates like:

http://localhost:5000/route/v1/driving/13.203616,52.54085;13.203601,52.539946?annotations=true&overview=full&geometries=geojson&continue_straight=false

The response route coordinates are :

[13.203616, 52.54085],
[13.203616, 52.54085],
[13.20322, 52.540827],
[13.203056, 52.540802],
[13.20289, 52.540753],
[13.20277, 52.540709],
[13.202634, 52.540617],
[13.202552, 52.540476],
[13.20256, 52.540359],
[13.202597, 52.540204],
[13.20278, 52.540038],
[13.202893, 52.539996],
[13.202946, 52.539977],
[13.203113, 52.539934],
[13.20333, 52.539924],
[13.203601, 52.539946],
[13.203601, 52.539946]

On the map that looks like:

Screenshot 2020-10-30 at 11 12 29

However, sending the request with those waypoints should return the same route:

http://localhost:5000/route/v1/driving/13.203616,52.54085;13.203616,52.54085;13.20322,52.540827;13.203056,52.540802;13.20289,52.540753;13.20277,52.540709;13.202634,52.540617;13.202552,52.540476;13.20256,52.540359;13.202597,52.540204;13.20278,52.540038;13.202893,52.539996;13.202946,52.539977;13.203113,52.539934;13.20333,52.539924;13.203601,52.539946;13.203601,52.539946?annotations=true&overview=full&geometries=geojson&continue_straight=false

The response route coordinates are :

[13.203616, 52.54085],
[13.203616, 52.54085],
[13.203616, 52.54085],
[13.20322, 52.540827],
[13.20322, 52.540827],
[13.203056, 52.540802],
[13.203056, 52.540802],
[13.20289, 52.540753],
[13.20289, 52.540753],
[13.20277, 52.540709],
[13.20277, 52.540709],
[13.202634, 52.540617],
[13.202634, 52.540617],
[13.202552, 52.540476],
[13.202552, 52.540476],
[13.20256, 52.540359],
[13.20256, 52.540359],
[13.202597, 52.540204],
[13.202597, 52.540204],
[13.202503, 52.540099],
[13.202484, 52.540079],
[13.202443, 52.540033],
[13.202421, 52.540011],
[13.202294, 52.539917],
[13.201958, 52.539711],
[13.202135, 52.539585],
[13.202437, 52.539728],
[13.202731, 52.53982],
[13.202795, 52.539841],
[13.202928, 52.539881],
[13.203113, 52.539934],
[13.20333, 52.539924],
[13.203601, 52.539946],
[13.203855, 52.540011],
[13.204069, 52.540161],
[13.204154, 52.540286],
[13.20416, 52.54042],
[13.204042, 52.540593],
[13.203922, 52.540713],
[13.203814, 52.540771],
[13.203616, 52.54085],
[13.20322, 52.540827],
[13.203056, 52.540802],
[13.20289, 52.540753],
[13.20277, 52.540709],
[13.202634, 52.540617],
[13.202552, 52.540476],
[13.20256, 52.540359],
[13.202597, 52.540204],
[13.20278, 52.540038],
[13.20278, 52.540038],
[13.202893, 52.539996],
[13.202893, 52.539996],
[13.202946, 52.539977],
[13.202946, 52.539977],
[13.203113, 52.539934],
[13.20333, 52.539924],
[13.203601, 52.539946],
[13.203855, 52.540011],
[13.204069, 52.540161],
[13.204154, 52.540286],
[13.20416, 52.54042],
[13.204042, 52.540593],
[13.203922, 52.540713],
[13.203814, 52.540771],
[13.203616, 52.54085],
[13.20322, 52.540827],
[13.203056, 52.540802],
[13.20289, 52.540753],
[13.20277, 52.540709],
[13.202634, 52.540617],
[13.202552, 52.540476],
[13.20256, 52.540359],
[13.202597, 52.540204],
[13.202503, 52.540099],
[13.202484, 52.540079],
[13.202443, 52.540033],
[13.202421, 52.540011],
[13.202294, 52.539917],
[13.201958, 52.539711],
[13.202135, 52.539585],
[13.202437, 52.539728],
[13.202731, 52.53982],
[13.202795, 52.539841],
[13.202928, 52.539881],
[13.203113, 52.539934],
[13.203113, 52.539934],
[13.20333, 52.539924],
[13.20333, 52.539924],
[13.203601, 52.539946],
[13.203601, 52.539946],
[13.203601, 52.539946]

Screenshot 2020-10-30 at 11 17 04

I am aware there are similar reports of the same behaviour, but setting continue_straight=false does not avoid the route to be extended like in the figure.

Perhaps someone can help me understanding the reason for this results?

Thank you!

@danpat
Copy link
Member

danpat commented Oct 30, 2020

When you pass in a coordinate that is exactly at an intersection, it's a bit of a crapshoot whether it'll snap to the edge before or after the intersection.

If there are oneways involved, this can force the route to take a big detour.

An explanation and suggest path to addressing this is described in #4465

You can avoid this by using the /match service instead of /route - /match will try several nearby candidate snapping points, and should resolve the issue for you.

@siljuovix
Copy link
Author

@danpat I understand now. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants