Unexpected routing by bike, ignoring cycle paths

Hi,
I have tried GraphHopper to calculate a routing by bike where it should select acycle path and it does not unexpectedly.

On line link don’t show the routing but at least you have the example.

Here is a snapshot of the routing obtained off-line:

It should take the cycle path underlined in red.

As you can see in the url, it is a customed profile for EUC, but mostly as a bike with:

{
  "if": "road_class == CYCLEWAY",
  "multiply_by": 1.0
},

Other road_class are penalized.

Here is a view of the area from OSM, showing the cycle path it should have used:

My full euc.json:

{
  "priority": [
    {
      "if": "road_class == PRIMARY",
      "multiply_by": 0.5
    },
    {
      "if": "road_class == SECONDARY",
      "multiply_by": 0.7
    },
    {
      "if": "road_class == TERTIARY",
      "multiply_by": 0.8
    },
    {
      "if": "road_class == CYCLEWAY",
      "multiply_by": 1.0
    },
    {
      "if": "road_class == MOTORWAY || road_class == TRUNK || road_class == PEDESTRIAN || road_class == FOOTWAY || road_class == BRIDLEWAY",
      "multiply_by": 0.0
    },
    {
      "if": "max_speed > 80",
      "multiply_by": 0.4
    },
    {
      "if": "surface == ASPHALT || surface == CONCRETE",
      "multiply_by": 1.0
    },
    {
      "if": "surface == GRAVEL || track_type == GRADE3",
      "multiply_by": 0.6
    },
    {
      "if": "surface == DIRT || track_type == GRADE4",
      "multiply_by": 0.3
    },
    {
      "if": "track_type == GRADE5",
      "multiply_by": 0.1
    },
  ],
  "speed": [
    {
      "if": "true",
      "limit_to": "20"
    },
    {
      "if": "surface == ASPHALT || surface == CONCRETE",
      "limit_to": "25"
    },
    {
      "if": "surface == GRAVEL || track_type == GRADE3",
      "limit_to": "18"
    },
    {
      "if": "surface == DIRT || track_type == GRADE4",
      "limit_to": "10"
    },
    {
      "if": "track_type == GRADE5 || smoothness == VERY_BAD",
      "limit_to": "6"
    }
  ]
}

What could be the reason for that?

Hi,

first of all, the term bike_network in GH does not care about real infrastructure such as cycleways but it only takes (bicycles-)routes into account.
The definition of a bicycle route in OSM can be found here:
https://wiki.openstreetmap.org/wiki/Tag:route%3Dbicycle
To get a better unterstanding, here is a overpass-query for your area of interest:

Also I made a query with “real” cycleways in OSM for your area of interest:

In blue you see the separate cycleway infrastucture, that is also considered as road_class == CYCLEWAY in GH. Then in green there is cycleway infrastucture that is tagged not separatly but as an attribute of a road/highway. The GH-roadclass here is not cycleway but rather the corresponding highway-type in OSM, which I tried to describe also in here:

To achive what you want (routing on cycleway infrastucture?) you rather need customize the priority weights for road_class, however, in my understanding the not-separated cycleways (see green-colered ways in the query above) can not be taken into account in GH, so far. (?)

I simplified your example:

You can play around with the weights of
road_class == CYCLEWAY
bike_network == MISSING
to get a better unterstanding.

Disclaimer: I am quite new to GH, however know OSM pretty well. I am happy to be corrected.

1 Like

Thanks for your help. So as I play already with weights for road_class, I just need to add penalty when bike_network == MISSING, isn’t it ?

It looks like you did not have GH developers feedback from your post?

EDIT:

Here is the result:

I have added the following:

    {
      "if": "road_class == CYCLEWAY || bike_network != MISSING",
      "multiply_by": 1.0
    },
    {
      "if": "bike_network == MISSING",
      "multiply_by": 0.4
    },

It takes now the strong cycle infrastructure of Bordeaux, the REVE cycle network.

It really depends if you care more about the (touristic) bicycle routes or you just care about “real” cycling infrastucture.

For example:
Should the routing prefare a cycleway that is part of a cycling route (f.e. the cycleway along Chemin du Phare Way: 458671183 | OpenStreetMap ) over another cycleway that is not part of a cycling route (f.e. the cycleway along Avenue Marie Curie Way: 744694308 | OpenStreetMap )?

Another example:
Should the routing prefare a tertiary highway without a cycleway but which is part of bicycle route ( f.e. Rue Toussaint Catros Way: ‪Rue Toussaint Catros‬ (‪398329290‬) | OpenStreetMap ) over a “real” cycleway that is not part of a bicycle route (f.e. Avenue de la Grande Semaine Way: 755878915 | OpenStreetMap ).
Depending on the custom weights, the route will either go along one or another:

With penalty for bike_network==MISSING:

Without penalty for bike_network==MISSING:

1 Like

Thanks for your deep explanations, it is not an obvious topic. My need is to maximize cycleways. Being part of a bicycle route is not by itself a criteria for me, more a consequence. So I will try your last setup.

1 Like

Somehow I missed this discussion. As was pointed out before we are preferring segments which are part of a bicycle route relation. If you want to avoid that I would suggest the following custom rule:

{
  "priority": [
    {
      "if": "bike_network == LOCAL",
      "limit_to": "1.1"
    }
  ]
}
1 Like