Reading encoded values, that comes from relation, inside access parser

Would it be possible to read encoded values inside access parser (BikeCommonAccessParser)?

I would like to use bike_network value inside access parser to conditionally allow ways with bicycle=no. It comes from way’s relation and I can’t find a way how to do it in the code.

I have one example where there is a bridge with bicycle=no but that bridge is part of a cycling route relation.

Right now GH is skipping this bridge (Am I getting this right?) and it can’t be used for routing.
Do you think this example should be treated as a bug or wrong tagging inside OSM?

Considering the path before and after is tagged as bicycle=yes and the bridge is even part of a bike network this is likely bad tagging. It is also tagged as width=0.3 which would be very narrow?

The bike networks are parsed before the way tag parsers so the bike network information is already available for BikeCommonAccessParser. So, yes, it is possible to access the bike network encoded values in the bike access parsers.

Thanks for the answer. width=0.3 seems like an error but maybe that bridge is very narrow and that’s why there is bicycle=no? But probably it should be bicycle= dismount .

Could you tell me how exactly I could access that informations? I can’t wrap my head around those relationFlags. I don’t have any experience with Java, just learning along the way :slight_smile:

Yes, bicycle=dismount could be more appropriate, but hard to tell without local knowledge or imagery.

To access the network information in BikeCommonAccessParser you need to pass EnumEncodedValue<RouteNetwork> bikeRouteNetworkEnc in the BikeCommonAccessParser just like it is done for the roundaboutEnc currently. You’ll get it from the EncodedValueLookup by calling lookup.getEnumEncodedValue(BikeNetwork.KEY, RouteNetwork.class). With this in place you can then just read the bike network like bikeRouteNetworkEnc.getEnum(reverse, edgeId, edgeIntAccess) in BikeCommonAccessParser#handleWayTags.

1 Like

Thanks a ton! It worked.

Here is a commit if anyone will be interested: pass bike route network encoder to access parser · caspg/graphhopper@2c1993d · GitHub

1 Like