# Bike priority on one way road opened to bike in the opposite direction

Hello,

I have been playing around with Graphhopper for a while, and would like to thanks the whole team for the tool.
I am now trying (with limited level in java) to play with the routing for bike (using version 5.3), and have detected something that looks strange to me.

I have difficulties understanding the calculation of bike priority for a road (Way: ‪Rue Boussingault‬ (‪32529500‬) | OpenStreetMap) with the following tags :
cycleway = opposite
cycleway:both = no
highway = residential
lane_markings = no
lit = yes
maxspeed = 30
name = Rue Boussingault
oneway = yes
oneway:bicycle = no
sidewalk = both
surface = asphalt

Using bike flag encoder, the priority for weighting=fastest is PREFER (1.2), and I am not really able to understand why.
As far as I understand it, isBackward is set to true for this link, but then I don’t understand how the priority is derived from the various tags.

Beyond the calculations, the roads marked with cycleway = opposite are, according to this :

“cycleway=opposite is used in situations where cyclists are permitted to travel in both directions on a road which is one-way for normal traffic, in situations where there is no dedicated contra-flow lane marked for cyclists”.

I would therefore assume a lower level of priority in such case than the current PREFER (may be UNCHANGED of SLIGHT_AVOID). How would the code need to be changed acccordingly ?

Many thanks to the whole Graphhopper team.

The answer is simply because ways tagged with `highway=residential` are in the list of preferd highway tags. See the code.

1 Like

Thank you @ratrun ! It clarifies the whole stuff.

Following your answer @ratrun , and if I correctly understand the code, a way which is in the list of prefered highway tags (and matches the speed condition) would be in PREFER :

``````if (preferHighwayTags.contains(highway) || (isValidSpeed(maxSpeed) && maxSpeed <= 30)) {
if (!isValidSpeed(maxSpeed) || maxSpeed < avoidSpeedLimit) {
weightToPrioMap.put(40d, PREFER.getValue());
``````

But the same way with a cycleway=lane tag would be only UNCHANGED :

``````String cycleway = way.getFirstPriorityTag(Arrays.asList("cycleway", "cycleway:left", "cycleway:right"));
if (Arrays.asList("lane", "shared_lane", "share_busway", "shoulder").contains(cycleway)) {
weightToPrioMap.put(100d, UNCHANGED.getValue());
``````

And this is because the associated 100d weight would take the priority over the 40d of the prefered highway condition
Am I understanding correctly ?

Thanks again !!

Yes, you are right.

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