Subject: Turning in the middle of a street should be prohibited

Hi @all,

our network has tight streets and our customized vehicles are to big to do a turn in the middle of a street. How can i accomplish this requirement with graphhopper?

Simple graph example:
sss|sss |
sss|sss |
sss|sss |

(s: empty space)

We want to route from A to C over an interpolated waypoint between B, D.

Current route calculation:
A -> B -> center-point(B,D) -> B -> C

Favored route calculation:
A -> B -> center-point(B,D) -> D -> E -> C

Thanks in advance.

Best regards,


BTW: Lets define X=center-point(B,D)

You can use turn costs (or restrictions) to reflect this. So in the graph you would model that the turn from B->X->B should be avoided or even forbidden using the TurnCostExtension.addTurnInfo method (see its tests for the details)

Is the TurnCostExtension only activated in none-CH mode?

Yes, turn costs and restrictions are not yet supported with CH. Note that there is a new, fast routing mode (hybrid mode) which support turn costs.

Nice:)! In which version? 0.9?

Yes, you can try the recently released 0.9.0-RC1

I found in the documentation, that gh is able to avoid u-turns at via points.

But for my case above is does not work. Need i a special OSM tag? How i force gh to route no back?
How can i force to route over A -> B -> X -> D -> E -> C?

In the next example i prefer to route through “Friedrichstraße” instead of doing a u-turn:

Thanks for your help or any advice.
Congratulations for the current release:)!

You can try the pass_through option in this case:

Now, heading is probably not what you want. With it you can force the orientation of the vehicle at the via location but this will not avoid the u-turn. See this example:

It would be nice to control the u-turn penalty, but this currently only possible via using the low level API via turnWeighting.setDefaultUTurnCost

Congratulations for the current release:)!


Thanks for your help:).

If i use weighting=shortest, it does not work:(



Why is there a difference when i use “fastest” instead “shortest”? Is this a bug or a feature?

I need this behavior also for shortest mode.

Please see this issue:

Also keep in mind that ‘short_fastest’ is probably the ‘shortest’ that you want.