User:Ömmes/Wayparts

From OpenStreetMap Wiki
Jump to navigation Jump to search

Purpose of Wayparts

Wayparts should make it possible to define a way not only by its position, function etc. but by seperating it into different parts. These parts will be lanes for "normal" traffic, cycleways, footways, parking lanes and so on. It is possible to add as many parts to a way as needed. Each waypart can contain tags to describe it in particular, i. e. access, function, width, divider and so on.

To be flexible with the definition of wayparts, the parts are created as relations. A relation can be of the type "waypart" for a single part of a way or "wayparts" to define one or more parts in a grouped relation.

Each relation contains at least one member: the way it belongs to. Additional members can be a start node and an end node. With these nodes it is possible to "split" a single way in different waypart "sections" without having to split the way in real (e. g. a single way starts with 2 wayparts, from the middle till the end it has 3 parts). Also more then tow or more contiguous ways can be member of the same waypart(s) by adding them as members and selecting the start node from the first and the end node from the last way of the sequence. Therfore the waypart is not depended to the direction of a way if start and end nodes are set.

Defining wayparts

Each part of a way - a waypart - gets its number to indicate the ordering. Positive numbers define forward parts (usually on the right side of the road), negative numbers mean backward parts.

A relation of the type wayparts is meant to define the "default" parts of a way, i. e. the parts which follow the way for a longer distance. A single waypart might be used to add an extra part to the way.

Example: A motorway with 2 lanes and some exits/exit lanes. The 2 main lanes go into a wayparts relation, each of the exit lanes will be added as a waypart (using a start and end node).

relation waypart relation (a single part)

Tags

Key Mandatory Value Explanation
type yes waypart Always "waypart"
part yes Number/Text positive (forward) or negative (backward) Number. May be extended by characters or decimals, e.g. 1, 1.2, -1, -1b.
parttype no Text Typically a highway value, e. g. cycleway, footway. If not set it's assumed to be the same as the way. Other values may be something like "grass_strip"
divider no Text The divider is drawn on the inner side of the part. Examples: line, doubbleline, dash, doubbledash, curb, none
outer_divider no Text Same as divider but drawn on the outer side of the part.
(outer_)divider:width no Text Width of divider in meters
(outer_)divider:crossable no Text yes, no or list of access types (e. g. "foot;bicycle"). Common dividers like a solid line should be defined with an implicit crossable value. If the value differs it could and should be tagged.
direction no Text oneway, opposite, both, variable. Default is oneway except for footways.

The direction is relative to start and end node (see below). So forward parts will point from start to end and backward parts from end to start, by default as oneway. So an "opposite backward part" will be accessible from start node to end node.

direction_hint no Text left, right, straight on, half left, half right etc. May be used to draw an arrow if the waypart is visualised
destination nein Text Destination, i. e. what is mentioned on the according sign
width no Number The width of the part in meters
other way tags no access, surface and so on

Members

Role Mandatory Multiple Value Explanation
way yes yes way way ways of the waypart. Multiple ways have to be sorted correctly in one direction.
start no no node node
end no no node node
via no yes node node For closed ways a via node has to be defined to indicate the direction
to no yes relation waypart, way way The waypart or way you will get to, e. g. the street to the right for a right turn lane.


relation wayparts relation (one or more parts)

A wayparts relation adds one or more parts to a way. The simplest use is setting a value for parts.

Individual parts can be tagged as partX and part-X where X is the part number. Additional tags can be set as partX:key and part-X:key.

Tags

Key Mandatory Multiple Value Explanation
type yes no wayparts Always "wayparts"
parts yes, if no individual parts are tagged no Number Amount of automatically created parts. Usefull if there are lanes with same properties. The number will be seperated in backward and foward parts. Even numbers result in the same number of ways for forward/backward, odd numbers have 1 forward way more than backward.
parts:forward no no Number Amount of automatically created parts in forward direction. (Overrides the calculated value from parts.)
parts:backward no no Number Amount of automatically created parts in backward direction. (Overrides the calculated value from parts.)
keys... no yes Text Additional (default) tags for all parts.

Possible tags are the same as for a single waypart (divider, direction, direction_hint, destination) and all other possible way tags.

partX no yes Text The parttype for forward part number X. Typically a highway value, e. g. cycleway, footway. If not set it's assumed to be the same as the way. Other values may be something like "grass_strip"
part-X no yes Text The parttype for backward part number X. Typically a highway value, e. g. cycleway, footway. If not set it's assumed to be the same as the way. Other values may be something like "grass_strip"
partX:keys... no yes Text Additional tags for forward part number X.

Possible tags are the same as for a single waypart (divider, direction, direction_hint, destination) and all other possible way tags.

part-X:keys... no yes Text Additional tags for backward part number X.

Possible tags are the same as for a single waypart (divider, outer_divider, direction, direction_hint, destination) and all other possible way tags.

Members

Role Mandatory Multiple Value Explanation
way yes yes way way ways of the wayparts. Multiple ways have to be sorted correctly in one direction.
start no no node node
end no no node node
via no yes node node For closed ways a via node has to be defined to indicate the direction
to no yes relation waypart, way way The waypart or way you will get to, e. g. the street to the right for a right turn lanes.
partX:to no yes relation waypart, way way The waypart or way you will get to from forward part X, e. g. the street to the right for a right turn lane.
part-X:to no yes relation waypart, way way The waypart or way you will get to from backward part X, e. g. the street to the right for a right turn lane.


Examples

Trunk link

                 |
                 E
                 |
 <==============]|[========     a, b, c, d: Nodes
                ]D[
 ==a=====b== A =]|[=======>     A, B, C, D, E: ways
         \_____  |
             B \ C
                \|
                 c
                 |
                 d
                 |
                 |


way Way A highway=trunk, oneway=yes

way Way B highway=trunk_link, oneway=yes

way Way C highway=primary

way Way D highway=primary, bridge=yes, layer=1

way Way E highway=primary


relation Relation 1

type=wayparts

parts:forward=2

divider=dash

Role Item
way way Way A

relation Relation 2

type=waypart

part=3

divider=doubbledash

direction_hint=right

Role Item
start node Node a
way way Way A
end node Node b
to relation Relation 3 (or way Way B)

relation Relation 3

type=wayparts

parts=1

Role Item
way way Way B
to relation Relation 5

relation Relation 4

type=wayparts

parts=2

divider=dash

Role Item
way way Way C
way way Way D
way way Way E

relation Relation 5

type=waypart

part=2

divider=doubbledash

Role Item
start node Node c
way way Way C
end node Node d

Motorway link (live example)

I added waypart relations to the motorway link A 2/B 239 "Herford/Bad Salzuflen", see Changeset 3125502

http://www.openstreetmap.org/?lat=52.0914&lon=8.6951&zoom=13


Just download that area with JOSM, it should look like this with active Wayparts plugin:

Example A 2/B 239 "Herford/Bad Salzuflen"

JOSM plugin

The JOSM plugin for Wayparts is in an early state, but you can try it:

Download: http://www.ömmes.de/osm/wayparts.jar

Copy the file to your JOSM plugin directory: see http://wiki.openstreetmap.org/wiki/JOSM/Plugins#Manually

Use the JOSM latest version. As the current version is somehow broken, use this one: http://josm.openstreetmap.de/download/josm-snapshot-2447.jar

Usage

The plugin adds a layer which displays the Wayparts of the active edit layer. You can remove the Wayparts layer but actually not add it again unless you load data into a new edit layer.

Known issues

  • Wayparts on closed ways/streets are not detected and might end up in an error
  • Gaps between way members (i. e. a way is not connected to the next) of a Waypart relation will be rendered as if there was a way between the two member ways
  • Overlapping Waypart relations defined in opposite direction are rendered on the wrong side --Ömmes 18:50, 16 November 2009 (UTC)
  • Overlapping Waypart relations might not be rendered with divider --Ömmes 18:50, 16 November 2009 (UTC)
  • If something is deleted or added all Wayparts are parsed again. This might be slow...
  • Only cycleway, footway and grass_strip are rendered different then streets
  • Only dash, doubbledash, line, grass_strip and curb are rendered as divider
  • "to" members of a Waypart relation is not taken into account for rendering, so the lanes may start or end at wrong other lanes

Todo

  • Define strokes and colors in XML file
  • Improve performance on data changes
  • Fix known issues
  • Integrate an Waypart editor

Links to related wiki pages