Is it possible to ignore barriers in the racing bike profile?

When I try to route from point A to point B, as shown in the screenshot below, Graphhopper never takes the shortest route. I believe this is due to a misplaced barrier, which should be beside the road, not on it. In Graphhopper 7 this was working but in Graphhopper 9 not anymore.

Is it possible to ignore barriers using a custom model? I tried the following configuration:

{ 
  "priority": [
    { "if": "!racingbike_access",  "multiply_by": "1" },
  ],
  "speed": [
    { "if": "true", "limit_to": "racingbike_average_speed" }
  ]
}

However, it does not seem to work.

Unfortunately I cannot reproduce the issue:

https://graphhopper.com/maps/?point=50.395708%2C5.752995&point=50.393646%2C5.753306&profile=racingbike&layer=OpenStreetMap

Did you try with the provided custom model racingbike.json as described in the config file?

Yes at first we used the default custom_models, and later we did some tuning. Is it possible a value in the config could have this effect?

The model you posted does not look right as you basically ignore the access restrictions (due to multiply_by:1), but it should not cause the problem you see. So it is tricky to say what is causing the problem without the actual custom model you are using.

Sorry for the late reply; I was away for a few days. Below is the custom model we are currently using:

# To use this custom model, set the following option in the config.yml:
# graph.elevation.provider: srtm   # enables elevation
# profiles:
#    - name: racingbike
#      custom_model_files: [racingbike.json, bike_elevation.json]

{
  "priority": [
    { "if": "!racingbike_access", "multiply_by": "1" }
  ],
  "speed": [
    { "if": "true", "limit_to": "racingbike_average_speed" }
  ]
}

I set multiply_by: 1 in the hope that it would solve the issue, but from your response and what we are currently observing, I guess it will not.

We also used this model without result:

// to use this custom model you set the following option in the config.yml:
// graph.elevation.provider: srtm   # enables elevation
// profiles:
//    - name: racingbike
//      custom_model_files: [racingbike.json, bike_elevation.json]

{
"priority": [
{ "if": "!racingbike_access && (!backward_racingbike_access || roundabout)",  "multiply_by": "0" },
{ "else_if": "!racingbike_access && backward_racingbike_access",  "multiply_by": "0.2" }
],
"speed": [
{ "if": "true", "limit_to": "racingbike_average_speed" },
{ "if": "!racingbike_access && backward_racingbike_access && !roundabout", "limit_to": "5" }
]
}

The second custom model you posted should work. It is identical to what we use in production.

I have just this in my config.yml now and it is still not working. I’m kinda lost now.

...
profiles:
    - name: racingbike
      custom_model_files: [racingbike.json, bike_elevation.json]

profiles_ch:
    - profile: racingbike

...

Ah I see a difference between your map and mine. The barrier is not visible on your version. Can it be the source of your map is older then this change where the barrier was added?

I just tried with the latest version 9.1, your config and the most recent map data (export from openstreetmap.org) and it works for me and racingbike passes this barrier.

here is my config:

graphhopper:
  datareader.file: ""
  graph.location: graph-cache

  profiles:
    - name: racingbike
      custom_model_files: [racingbike.json, bike_elevation.json]

  profiles_ch:
    - profile: racingbike

  graph.encoded_values: racingbike_priority, racingbike_access, roundabout, racingbike_average_speed, average_slope

  prepare.min_network_size: 200
  import.osm.ignored_highways: ''

Yes, found the issue. It was not in the custom model like you said. It was ignored_highways. I had pedestrian,footway,steps as value. After removing footway it works. Not sure if this is wat we want but it’s a lot better then what is was. Thanks for your help!

This is just a storage optimization config. You should left it empty or use only e.g. motorway,trunk when using only outdoor profiles (for only motor vehicles different values should be used and are explained in the config).

pedestrian and footway should probably not ignored as sometimes the best route if you accept “getting off the bike” which GraphHopper supports by default.

1 Like