Graphhopper is not working with turn restriction config

Hello everyone, I don’t know why my web is not working with turn restriction config. I hope you help me fix this error. Thank you so much!


AFAIK to enable turn restrictions you have to:

  • update graph.flag_encoders (as you did)
  • add turn_costs: true to your profile configuration:
profiles:
    - name: my_bike /* or how you call it */
      vehicle: bike
      weighting: fastest
      turn_costs: true
1 Like

You should even be able to leave out the entire graph.flag_encoders entry. It will be determined implicitly from the profile vehicles (and the turn_costs field of the profiles).

1 Like

Thank you so much. I don’t know if activating turn_restriction will affect performance because as far as I know, using turn_restriction means disable CH.

Thank you so much. I don’t know if activating turn_restriction will affect performance because as far as I know, using turn_restriction means disable CH.

No, CH also supports turn restrictions since version 1.0 (or even earlier). Activating turn costs will make the routing slower, but for example CH with turn costs is still orders of magnitudes faster than routing without turn costs without CH. CH with turn costs needs a longer preparation and requires more memory though. See also this article: Host Your Own Worldwide Route Calculator With GraphHopper - GraphHopper Directions API

1 Like

I was applied turn restriction in file config and memory increase from 2g ram to 11g ram. Can you explain to me why there is such a dramatic change? Thank you so much!

As mentioned in the article I linked to above CH requires a lot more memory when turn costs are included. Simply speaking there are a lot more ways to consider when the CH shortcut edges are introduced, so there need to be more of them.

1 Like

Thank you, but I don’t understand why my data has only one row about relation which has type is restriction but there is such a large memory difference. Do you know why?

Yes, it’s because another algorithm needs to be used when turn restrictions are enabled and that requires more memory. You could also use LM where turn restrictions to not require more memory.

1 Like

Do you know what it uses more memory for?

Like I said there are more shortcut edges

1 Like

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