Opened 8 years ago

Last modified 7 years ago

#1300 new defect/bug

Bicycle routing ignores oneway restrictions

Reported by: mvglasow (2) Owned by: KaZeR
Priority: major Milestone:
Component: core Version: git master
Severity: normal Keywords:
Cc: sebastian.leske@…,, (2)


When in bike routing mode, Navit will frequently send me down a one-way street in the wrong direction. Examining the vehicle profile reveals that indeed the bike profile is configured to ignore oneway restrictions.

This will give incorrect routing in a number of places (one example being Germany) where one-way restrictions generally apply to bicycles, unless signs state otherwise.

Unfortunately, this won't be an easy fix for a number of reasons:

  • Just changing the vehicle profile will always give incorrect results somewhere in the world, as there are places in the world (such as the Netherlands) where one-way restrictions generally do not apply to bikes. Since this setting requires messing with navit.xml, it's not quite trivial and out of reach for many users. And those who cross borders, e.g. between the Netherlands and Germany, would need to change it every time they change from one country into another.
  • While OSM has per-vehicle oneway tags (such as oneway=yes; bicycle:oneway=no), the meaning of the generic oneway tag may vary: while we can generally assume it to apply to motor vehicles but not to pedestrians, the situation for bikes is less clear, as it depends on local legislation whether or not the generic oneway tag applies to bikes.
  • Navit internally uses two one-way flags, one for each direction, with no further distinction to the types of vehicles the restriction applies to.

We would therefore need to do the following:

  • Change the internal representation and introduce separate one-way flags by vehicle type, either instead of or in addition to the generic one.
  • Maintain a per-country list of vehicle types that are exempted from one-way restrictions.
  • In maptool, determine for each one-way road which country it is in and, using the list, to which vehicle types generic oneway restrictions apply, and set flags accordingly.

Alternatively, we could also introduce tri-state flags (yes/no/unset) and have maptool process only the raw tags, then do all country-related logic at run time in navit at the time the attribute is queried.

Change History (3)

comment:1 in reply to: ↑ description Changed 8 years ago by sleske

  • Cc sebastian.leske@… added

Replying to (2):

there are places in the world (such as the Netherlands) where one-way restrictions generally do not apply to bikes

Do you have any example for such countries? In the Netherlands one-way restrictions do apply to bikes, unless there is an additional sign with an exception. See e.g. the page for an overview of the signs in the Netherlands; note there is a special sign to indicate that a one-way street does not apply to bicycles (under the heading "5. Onderbord: Uitgezonderd fietsers en bromfietsers").

Since traffic signs and regulations are (mostly) similar at least in the European Union, I would assume this also applies to most EU countries.

So unless we find counter-examples, we can probably (for now) assume that one-way streets apply to all vehicle types, unless they are tagged specially (e.g. "oneway:bicycle=no" in OSM).

comment:2 Changed 7 years ago by mvglasow (2)

You're right, my bad. I'm not aware of any countries that have a generic exemption from one-way restrictions for bikes. Thus for the moment I would assume that, where such exceptions exist, they are indicated by a sign and need to be tagged accordingly.

With that assumption we would simply need to redefine the flag semantics, introducing one new flag per vehicle type.

We would need to think about backward compatibility, though – both in terms of new Navit builds using old maps and vice versa. In order for one-way restrictions to be processed correctly, both the maptool version used to build the map and the running Navit version need to implement the fix. If only one of them implements it, we need to make sure that at least we don't introduce any new errors.

IIRC, access restriction flags apply to the generally allowed direction (forward in most cases, unless the way has oneway=-1, in which the flags apply to the backward direction).

In order to work flawlessly with older Navit builds, existing flags would need to be preserved with the same semantics. That would also include the generic one-way flags used until now.

We could then introduce a second set of access flags that specify exemptions to the one-way rule. In current maps these bits should be reserved and set to 0. We could then set them to 1 where an exception exists.

The flags would then be parsed as follows:

  • If the oneway flag for the direction is 1 (allowed), access is determined by ACCESS_FLAGS.
  • If the oneway flag for the direction is 0 (forbidden), access is determined by ACCESS_FLAGS XOR EXCEPTION_FLAGS.

comment:3 Changed 7 years ago by mvglasow (2)

  • Cc (2) added
Note: See TracTickets for help on using tickets.