Route ignores "No Right Turn" restriction


#1

https://maps.openrouteservice.org/directions?n1=-37.783723&n2=175.282767&n3=15&a=-37.778483,175.281672,-37.793474,175.288324&b=0&c=0&k1=en-US&k2=km

Openstreetmap has this intersection as a “no right turn” yet the route ignores this.
Is this a bug or is there another way to ask the openrouteservice to respect this rule


#2

Thank you for reaching out!

The reason for the observed behavior it is that the default routing algorithm which is optimized for speed does not support turn restrictions. This algorithm is used when no route preferences are specified.

Turn restrictions are respected once you enable some filters, for example try Avoid road types: ferries . This of course doesn’t have any direct influence on this particular route, however, it triggers another algorithm at the backed which resolves turn restrictions correctly, see here.

When querying the API directly one can force the latter algorithm by appending to the request optimized=false parameter without the need of specifying any custom route preferences.

Cheers,
Andrzej


#3

Brilliant - Thankyou, This is a fantastic service you have here, Will donate something to the project next week.