Directions: Prefer cycle_highways

Hi

For a client we are looking into building a routing service specific for cycling.
In Belgium there are a few cycle_highways they are inputted in OSM.
https://wiki.openstreetmap.org/wiki/WikiProject_Belgium/Conventions/Cycle_Routes
And tagged with “cycle_network=cycle_highway”
https://wiki.openstreetmap.org/wiki/Tag:cycle_network%3Dcycle_highway

Is there any way get the best route preferring the segments tagged with cycle_highways?

Thx

Hi,
currently this tagging is not used for the bike routing. We do have a recommended setting for the bike routing, which will return a route optimized with regards both to speed and usability of roads for bikes. But that specific tag is not used. If you have the time and knowledge, you could adapt the process and add this tag to it?

Cheers

Hi

We are willing to invest some time, but have little to none experience in OSM & ORS.
Can you point us in the right direction? Is there a basic guide on how to start on this?

Thx

I can point you in a direction, but a guide I cannot really offer. I think if you are willing to invest some development time, you need to start by setting up your own small openrouteservice instance. As ORS is in some ways an extension of Graphhopper (GH), you will need this one as well.
The basics of what you want to achieve can be done like this (from a quick look into it):
The tags from the OSM file are read in the OSMReader class:

if (!relation.isMetaRelation() && relation.hasTag("type", "route"))
                        prepareWaysWithRelationInfo(relation);

This will call the encodingManager, which will be the BikeFlagEncoder. In this one, you will have to translate the relations that compromise the cycle_network types into values for ways. This might be a bit complicated. The basic problem is that as far as I can tell, the tag you are looking for is a relation, but we need the tag to be applied for all the ways that it corresponds to.
Afterwards, you can add the tag to the preferHighwayTag field in the BikeFlagEncoder constructor.
This will make cycleways preferred, in the same way as residential roads etc are preferred.
If you want even “more” preferred, you will need to create an additional category like the preferHighwayTag and then assign it a preference value in BikeCommonFlagEncoder.collect.

I am aware that this is not an easy and quick process, sadly.
Let me know if you need some additional help.

Cheers
Hendrik

1 Like