Routing violates traffic rules in some cases

Hi all!

The graphhopper routing library works very well (and fast) in general, but in certain cases we face problems with turns that does not regard traffic rules defined by the map. For example in Budapest, Hungary there is a place called “Blaha Lujza tér”. Left turns are forbidden here, however for some reason graphhopper makes it:

In contrast, the algoritm on openstreetmap.org handles this situation in the right way (see my next post).

We would be grateful if this problem could be solved somehow.

Thanks,
Akos

This is the right way to do the turn here:

Turn restrictions are not possible for the speed mode. Disable this and it will work for hybrid or flexibility mode if you specified turn_costs=true in the config.properties, see e.g. Are Turn Restrictions available if not using CH?

Thanks, this is the problem.

Flexible mode handles the situation well, but we would like to try hybrid mode for performance reasons. We can see that this mode can be enabled with “prepare.lm.weightings” key in config.properties, but is there a way to enable this via Java API? Or even on a per request basis?

Thanks,
Akos

IF you have enabled CH (speed mode) and LM (hybrid mode) in the config.properties and have stated explicit allowance to disable a certain mode (ch.disabling_allowed=true) then the following happens:

  • a CH request (default) or
  • a LM request (if ch.disable=true in the request) or a
  • a flexible request (if ch.disable=true&lm.disable=true)

if you disable CH or LM in the configs then this step is skipped. E.g. CH is disabled then the default request mode is LM.