Every now and then OSRM users report routes that take puzzling, unrealistic detours. For example, a user reported this route that went to extensive means to avoid going over Flottsundsbron, a narrow bridge with alternating direction of traffic in the south of Sweden.
Investigating this strange route led us to the
oneway=alternating tag in OpenStreetMap.
Flottsundsbron Photo by Mapillary user alatius under CC BY-SA 4.0.
oneway=reversible tag's usage on Flottsundsbron meant our routing engine avoided it completely.
A search for this tag in OSM will reveal that it has been used to express two different semantics.
On one hand the tag has been used to describe narrow bridges and tunnels that alternate direction of travel on a high frequency, say every five minutes. Encountering a oneway of this variety may add some amount of waiting time to the user's route, but the route is always accessible. Flottsundsbron is an example of this type of way; a changing traffic light dictates the direction of travel.
On the other hand there are oneways that change direction of travel very infrequently, like highways for the commute into a city in the morning and out of it in the evening. For these it does not make sense to let the user wait until the direction of travel changes. This highway, I-95 in northern Virginia is an example of a highway that reverses its direction twice a day.
If the routing engine doesn't know about the frequency of direction change there is no way to distinguish between the two semantics being overloaded in the
- high-frequency direction changes can be tagged as
- low-frequency direction changes continue to be tagged
With distinct semantics in place we route you over
oneway=alternating but apply a penalty for waiting time.
Check out the tags' Wiki pages for more detailed descriptions:
You can read up on the original discussion with the Routing Engine. This feature is included in the latest OSRM v5.5 Release. We're always glad for user feedback; in case you stumble over issues like this please talk to us! You can find us in the OSRM Repository on IRC and on the osrm-talk mailinglist.