Computing access restrictions

From OpenStreetMap Wiki
Jump to navigation Jump to search

Problem

Given a specific highway and a specific access mode, what is the corresponding access restriction?

Example: suppose a specific highway=cycleway is tagged motor_vehicle=destination. How does it behave with respect to a motorcar? And to a horse?

The answer, whichever it is, must be computable by a routing software. Our aim is to provide a suitable algorithm everybody agrees upon.

A few examples

A highway=cycleway is tagged access=destination. Does this imply:

A highway=cycleway is tagged access=destination. Does this imply:

Parameters

Access mode tags

First of all, we need a set of access mode tags: this set needs not be complete nor set in stone, and could evolve over time when new access mode tags are created. Here is a partial list:

  • access
  • vehicle
  • motorcar
  • foot
  • etc.

Access mode hierarchy

We then need a relationship between the above tags, that is we need to state which tag is more generic and which one is more specific. Technically speaking, we want to arrange our access mode tags in a tree structure, where the tree root is the most generic tag and tags get more specific as we move away from the root.

The following is an example of such a tree, written in table form.

Access mode Is a child of
access tree root
foot access
vehicle access
horse vehicle
motor_vehicle vehicle
motorcar motor_vehicle
motorcycle motor_vehicle
psv motor_vehicle
taxi psv

This table is derived from Key:access and Approved_features/More_access_keys_and_values but other tables are possible: each country, for instance, can have its country-specific hierarchy.

Highway-specific defaults

As third and last parameter, we need default access restrictions for every highway type: that is, we need a set of defaults for highway=cycleway, another one for highway=motorway, etc.

Such defaults must be in the most generic form (see here to get an idea of most general unifiers), that is a default which states access=no must be preferred to a default which explicitly states motorcar=no, motorcycle=no and so on for each access mode tag.

For instance, the default for highway=cycleway could be access=no and bicycle=designated.

As before, each country could have its own country-specific defaults. The current defaults are documented here.

Algorithm

Input:

  • a specific highway with zero or more explicit access restrictions;
  • a specific access mode (e.g. bicycle, foot, motorcar etc.)

Output:

  • an access restriction (e.g. no, yes, destination, private etc.)

Steps:

  • Take the highway-specific defaults and use them to label the access mode tree. For instance, if the highway is a highway=cycleway and its defaults are access=no, bicycle=designated, the resulting tree will be:
    • node access is labelled no
    • node bicycle is labelled designated
    • all other nodes are unlabelled
  • Take the explicit access restrictions and apply them to the tree in the same vein; if a node is already labelled, overwrite its previous label with the new one. For instance, if the only explicit access restriction is motor_vehicle=destination the resulting tree after this second step will be:
    • node access is labelled no
    • node bicycle is labelled designated
    • node motor_vehicle is labelled destination
    • all other nodes are unlabelled
  • Take the access mode given as input and look it up in the tree: the output is the node label (if the node itself is labelled) or the label of its closest labelled ancestor. For instance, if the access mode given as input is motorcar:
    • node motorcar is not labelled, so look at its parent motor_vehicle;
    • node motor_vehicle is labelled destination, so the algorithm output is destination

Remarks

The algorithm parameters are:

  • the set of access mode tags
  • the access mode hierarchy
  • the highway-specific defaults

Therefore the algorithm is still valid if:

  • new access mode tags are introduced/old ones are removed
  • country-specific rules modify the access mode hierarchy (for instance stating that horses are / are not a vehicle)
  • country-specific rules modify the highway-specific defaults (for instance stating that mopeds are allowed on cycleway)

Therefore if you want to adapt this algorithm to your country:

  • do not alter the algorithm itself
  • document your country-specific rules (access mode hierarchy and highway-specific defaults)

See also

Key:access

Highway-specific defaults