Why does valhalla bicycle routing want to swerve into traffic here?

On this routing query, Valhalla makes the odd decision to leave the cycleway and venture out into a major trunk highway: OpenStreetMap

It’s not shorter, and it seems very odd to prefer highway=trunk over a highway=cycleway with bicycle=designated.

The only difference I can see is that a small section of the cycleway has motor_vehicle=destination, for access to a single house, which should clearly be a lot safer constant traffic at maxspeed=70

Is this a tagging issue (happy to learn!), or a routing engine issue?


Other routers (OSRM and GraphHopper) stays on the side track.

And the same problem you described is visible with Valhalla’s foot routing also.

So I think it would be worth a note to the developers. Maybe it’s by design, but it sure looks weird and would need some explanation.


Hello sbre,

That is a good question, without looking into the code of Valhalla it is uncertain how exactly this route has been chosen.

The road has not been marked as being illegal to use on a bicycle, I do not know if that is the case in your country. But in the Netherlands if there is a bike path it is illegal to use the roadway, so we tag the roadway with bicycle=use_sidepath


And it might be that the segregated=no gets a penalty for bikes because it might think that a shared path is slower?

Does this answer your question?

1 Like

also the routers have some trouble to route cars over the cycleway (despite of the motor_vehicle=destination).

There is infrastructure tagging (here, for bicycles, including tagging like highway=cycleway and cycleway=lane and things a router must pay attention to like motor_vehicle=destination), there is route=bicycle tagging (network=*cn…) there is the logic built into routers (which varies greatly). These are all quite different, the first two are fully owned (strongly and proudly) by OSM. Guessing at why one might infer a certain country’s laws “which make sense there” (because someone who bikes there locally both knows and says) in a router is quite open-ended. That’s asking a robot to be sort of human-smart and we are only part-way there, despite AI. AI lies to us like a rug and if it is sentient (not yet), hopes we won’t notice.

I continue to both do and believe in tagging my (our) best. Both on infrastructure elements and routing. Understanding what we mean when we tag in certain ways is important. Agreeing (by consensus) as we do is part of the journey. We must “mean something specific” when we tag, as often as possible, as crisply as we can utter it, our best. When we as humans tag (the first two out of three above), we tag “what is.” When routers route (the third), they infer “how best to do this” (and humans who bike there can often outsmart the router’s logic) with a rote algorithm. That last part is “asking a lot” (of cleverness) and some routers are excellent, some, not so great.

While it is good to have discussions like these so the message “something looks wonky” goes “up and down the chain” (from data in OSM to routers and other downstream use cases like renderers, overlays…and back again), I’m squarely “router folks have something to think about here” (or thereabouts). It wouldn’t surprise me to learn that Valhalla’s routing engine “might, could do this.”

I consider saying “nothing to see here” but that isn’t correct, it’s more like I’m holding my fingers close together and thinking “about this much.” My guess is for Valhalla, it is something to evaluate. For the rest of us, a good dialog, “about this much.”

OT\ In testing routing on a complex new roundabout mapped about 8 days ago, Valhalla was he quickest in just under 2 days (may be a coincidence just having mapped that before a periodic cycle update), today GraphHopper routing updated giving same good results for all 3 modes of transport, car, bike, foot. OSRM still not, routing still as were the old crossing junction there. A matter a patience when correcting routing. /OT