Jump to content

Forward, backward, left and right

From OpenStreetMap Wiki
(Redirected from Key:right/left/both)
Logo. Feature: Forward, backward, left and right
One example for Feature: Forward, backward, left and right
Description
Used to describe position or direction relative to a way.
Tags

Status
Approved (for left / right suffixes)

When adding details to highways or other ways, it is often important to differentiate between the direction of travel or the side of the way. To do this we define the four terms forward, backward, left and right, which all depend on the direction in which the way is drawn. Those directions matter for features such as one-way roads (oneway=yes), waterways (drawn downstream), and sidewalks (which can be placed on the left or right side of a road).

The forward direction of a way is defined as the one that matches the order of its nodes (normally, the order in which they are drawn), while the backward goes in reverse. Left and right refer to the two sides when facing forward.

Definition

In tagging, forward / backward and left / right are used as tag key suffixes and some tag values). They refer to a direction or side relative to a way.

Forward and backward

The key suffixes *:forward=* and *:backward=*) or tag values forward and backward describe a direction along a way. The code forward means the direction in which the way is drawn (nodes ordered), while backward means the opposite direction.

The oneway=yes tag is an example of a direction-dependent feature: if this tag is added to a way, it becomes a one-way in the forward direction, but the oneway=-1 tag means the same way drawn in the reverse direction so that the one-way is in the backward direction.

The lanes=* tag is another example of a direction-dependent feature: a road can have a different number of lanes for traffic in each direction. A common case is for example lanes=3, lanes:forward=1, lanes:backward=2. The third option *:both_ways=* is used for the lane in the middle of the road that is used in both directions (e.g. a centre turn lane). This should not be used to mean "forward and backward", as this is the default meaning of all un-suffixed keys. Under certain circumstances an additional forward or backward behind both_ways is needed.

If used as a suffix, it is placed at the end of the key but still in front of the suffix of the conditional restrictions syntax.

Left and right

The tag values left and right (or key suffixes *:left=* and *:right=*) describe a side of a way. left means the left-hand side of the way when looking in the forward direction (as defined above), while right means the right-hand side also when looking in the same direction.

To explicitly mark a feature to be present on both sides of the road, both or *:both=* is used.

If used as a key suffix, it is placed right after the main key, in front of all other subkeys or other suffixes.

Tagging

As part of the key

Forward, backward, left and right are often appended as a namespace to a tag's key. This is done by adding a colon and the desired direction or side to the key.

Note: *:both=* as suffix explicitly states it applies to both sides (as without it e.g. cycleway=lane might mean that there is a cycleway lane on the right side only, or on a left side only, or on both sides)

Examples include:

  • maxspeed:forward=* – maximum speed which only applies in forward direction
  • destination:lanes:forward=* – destination per lane in forward direction
  • lanes:backward=* – number of lanes in backward direction
  • change:lanes:backward=* – lane change restrictions for each lane in backward direction
  • change:lanes:forward=no|not_left|not_right|no – asymmetric lane change restrictions for each lane in forward direction.
  • turn:lanes:forward=* – turn indications for each lane in the forward direction
  • cycleway:left=* – a cycleway on the left side of the road
  • sidewalk:right:surface=* – surface of the sidewalk on the right-hand side.
  • parking:both=* – a parking lane on both sides of the road
  • name:left=*, name:right=* – when a street name is different on the right and left side
  • maxspeed:hgv:forward=* – maxspeed restriction for heavy goods vehicles in forward direction – note that direction suffix is added after main tag "maxspeed:hgv" that in itself is suffixed tag
  • sidewalk:left:bicycle:backward=* – access restriction for bicycles in backward direction on the sidewalk on the left-hand side
  • lanes:both_ways=1 turn:lanes:both_ways=left – centre turn lane, also known as a centre lane or two-way left turn lane
  • hgv:both_ways:forward=no – a rare example of access restrictions for heavy goods vehicles only in forward direction on the centre lane used for traffic in both directions.
  • turn:both_ways:backward=merge_to_right – a rare example of turn indication only in backward direction on the centre lane used for traffic in both directions.

As value

Forward, backward, left and right are also sometimes used as a tag's value. In this case, no additional namespace is added to the key of the tag.

Examples include:

Note: Using forward and backward on node nodes, e.g. highway=traffic_signals, is disputed, as it becomes ambiguous when splitting the way or connecting a crossing way at these nodes. A better alternative is direction=* with angle or cardinal direction as value.

Editing the direction of a way

iD

In iD the direction of a selected way is indicated by the triangular midpoints half way between each pair of nodes on a way (note that clicking and dragging these midpoints will add a new node to the selected way). Furthermore grey arrows are shown on the way (even when not selected) if it is tagged with a oneway=* tag. The arrow direction is the opposite of the way direction if it is tagged oneway=-1.

Direction can be reversed by right-clicking the way and clicking "Reverse" option from the context menu (shortcut key V). This operation is "smart" since it also swaps forward/backward and left/right tags or values on the way (but not oneway=*), preserving the original meaning.

Potlatch 2

In Potlatch 2 the direction of a selected way is shown ...

  • In Potlatch 2 the direction of a selected way is shown in the toolbox.
    ... in the toolbox in the bottom right hand corner (the arrow will rotate to indicate the selected way's direction, calculated by using the first and last node, arrowhead at last node equivalent).
  • ... if you choose the "Enhanced" map view in Potlatch 2 the direction is indicated by small, light grey arrows on the way itself. This only works if the way is tagged with key highway, railway or waterway (+ maybe also some other keys) and is currently not tagged as oneway street (reason follows).
  • If ways are tagged as oneway streets then they always show bigger, grey arrows which indicate the allowed oneway direction (which is the opposite of the way direction if it is tagged oneway=-1).

JOSM

In JOSM arrows are shown on the selected way. To show arrows for all ways, go to menu Edit → Preferences → Display Settings page → "OSM Data" tab: check "Draw Direction Arrows".

Merkaartor

In Merkaartor, you can switch way direction display between always-on, always-off, and only-oneways in the view menu.

Data view on osm.org

The node list of a way in the data view on osm.org is sorted:

  • The top/first node in the list is the start/first node of the way.
  • The bottom/last node in the list is the end/last node of the way.

way Example way data view. The data layer helps you to get to such a page.

Statistics by taginfo

Suffix taginfo Value taginfo
*:forward=* forward
*:backward=* backward
*:both_ways=*
*:left=* left
*:right=* right
*:both=* both

See also