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:
A—B---C
sss|sss |
sss|sss |
sss|sss |
sssD—E

(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,

Olli

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.
(/graphhopper/graphhopper/blob/master/docs/core/routing.md#heading)

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:
https://graphhopper.com/maps/?point=49.870044%2C11.892711&point=49.870314%2C11.892046&point=49.870691%2C11.892292&locale=de-DE&vehicle=car&weighting=fastest&elevation=true&use_miles=false&layer=Lyrk

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

You can try the pass_through option in this case: GraphHopper Maps | Route Planner

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: GraphHopper Maps | Route Planner

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!

Thanks for your help:).

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

Shortest:
https://graphhopper.com/maps/?point=49.870044%2C11.892711&point=49.870165%2C11.891606&point=49.870691%2C11.892292&locale=de-DE&vehicle=car&elevation=true&pass_through=true&ch.disable=true&weighting=shortest

Fastest:
https://graphhopper.com/maps/?point=49.870044%2C11.892711&point=49.870165%2C11.891606&point=49.870691%2C11.892292&locale=de-DE&vehicle=car&elevation=true&pass_through=true&ch.disable=true&weighting=fastest

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: https://github.com/graphhopper/graphhopper/issues/485

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