3

Short version

Turn restrictions don't seem to be taken into account in GraphHopper's routing, although their GitHub issues say it is implemented. Does anybody know the state of this? Is it implemented, but not merged, not released, not rolled out or simply not turned on? Or is there a problem with the data in the example below? What's the state of turn restrictions in other open OpenStreetmap-based routing solutions?

Detailed version

Situation

GraphHopper Maps is my go-to solution for routing. It seems the best routing service with OpenStreetmap data, which in turn is the most complete database for cycling ways and footpaths.

Since I'm also doing some OpenStreetmap mapping and wanted to advance to more sophisticated features like turn restrictions, I tried to learn from other people's examples. They seem to be recognized by JOSM, but not taken into account by GraphHopper.

Example

Here an example of medium complexity with a crossing that contains a right-turn restriction and a U-turn restriction. OpenStreetmap seems to have the proper turn restrictions and JOSM seems to understand them (judging from the traffic signs shown in the graphical representation).

Right-turn restriction

U-turn restriction

Note that I selected the "from" via in both cases, so it gets selected in the map visualization and you can confirm that there is no confusion between the "from" and "to" entry.

But when I try it on GraphHopper it turns out that neither of the two restrictions are taken into account. Both the right-turn and the subsequent U-turn in the route that GraphHopper proposes are actually illegal: enter image description here

GraphHopper implementation

So I was wondering, if the problem is in the OpenStreetmap data or in GraphHopper.

From the GitHub issue #2 "Support for turn restrictions and costs" I understand that the feature of turn restrictions was actually implemented a while ago. But there is a related GitHub issue #55 "Initial implementation of turn restriction support by khuebner" that talks about some merging problems with too complex code in a single commit. It also references the merge being split in several parts, the pull requests #133, #134, #135 and #158. They are all marked as "closed" or "merged".

Questions

So does anybody know what's the state of this? Is it implemented, but not merged, not released, not rolled out or simply not turned on? Or is there a problem with the data in this example? What's the state of turn restrictions in other open OpenStreetmap-based routing solutions?

1 Answer 1

2

The turn restriction (also turn cost) feature is currently not implemented for the speed-up-mode, and this speed-up-mode is used in GraphHopper Maps. But you can easily download GraphHopper enable the flexibility mode in the config.properties and it will work:

prepare.chWeighting=no
graph.flagEncoders=car|turnCosts=true

Update: all modes including speed mode do support turn restrictions (more general turn costs even) since v0.12.


edit: reflecting updated syntax of config.properties

prepare.ch.weightings=no
graph.flag_encoders=car|turn_costs=true
3
  • Thanks for the answer, works like a charm, both for the no-u-turn restriction (i.imgur.com/04Fc4im.png) and for the no-right-turn restriction (i.imgur.com/v1yYGoi.png). Please roll that out on the GraphHopper Maps website as soon as possible, this is an essential feature!
    – mastov
    Jun 9, 2015 at 14:15
  • Could it be this is still not implemented on graphopper.com/maps? I'm seeing a clear example of Graphopper ignoring a restriction=no_u_turn Dec 23, 2019 at 15:24
  • Do you have an example where it is wrong?
    – Karussell
    Dec 28, 2019 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.