Forbidding U-Turns - possible?

Hi all, had a question I was hoping someone could help me with.

Basically, I’d like to know whether it’s possible to forbid u-turns (or at the very least, add a penalty of some sort) while finding a route? I know we can deal with forbidden turns by adding “ch.disable = true”, but I’d like to reduce and possibly completely forbid u-turns altogether.

Thanks!

EDIT: Just to follow up: is there a way of identifying these U-turns, if we can’t forbid them?

A screenshot or link to GraphHopper Maps would help where you experience u-turns. If you mean u-turns at via points you can try pass_through=true or try the new curbside=right (only in 1.0-preX)

Hi karussell, I’ll try to cook up a simple example later and post a screenshot. But this happens when there are multiple stops. So, for instance,the vehicle gets to the stop 2, stops, then makes a u-turn back on the road to get to stop 3. Now, there will be some cases where this will be unavoidable, but it’s possible in some cases to take another road (even though it will take slightly longer, which I am ok with).

This is possible via pass_through - see the API docs: https://github.com/graphhopper/graphhopper/blob/0.13/docs/web/api-doc.md

Or use edge-based configuration and curbside=right

1 Like

Oh, that worked great. Thank you!

As a follow up to this question - there are some cases where a U-turn would obviously be unavoidable (such as when houses are down a cul-de-sac or a dead end). Is there a way in Graphhopper to detect (from a list of lat-long locations) such locations which are down a cul-de-sac?

No currently there is no special functionality that can be used to detect dead ends. If you are thinking about doing this in code it should be rather simple: Just iterate over all nodes and count the number of adjacent edges.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.