Relation
A relation is a Data Primitive that consists of one or more Tags and also an ordered list of one or more Nodes and/or Ways as members which is used to define logical or geographic relationships between other elements. A member of a relation can optionally have a Role which describe the part that a particular feature plays within a relation.
Contents |
Usage
Relations are use to model logical (and usually local) or geographic relationships between objects. They are not designed to hold loosely associated but widely spread items. It would be inappropriate, for instance, to use a relationship to group together 'All footpaths in East Anglia'.
Roles
A Role is an optional textual field describing the role of a member of a relation. For example, in the multipolygon relation, role=inner and role=outer are used to specify whether a way forms the inner or outer part of that polygon.
Types of relation 
- Main article: Types of relation
There are many Types of relation including.
- Relation:route is used to describe routes of many types, including hiking route, cycle routes and bus routes as well as named roads.
- Relation:multipolygon, used for defining larger Areas such as river banks and administrative boundaries.
- Relation:boundary to exclusively define administrative boundaries
- Relation:restriction to describe a restrictions such as 'no left turn', 'no U-turn' etc.
Examples
Bus route
A bus route might have a relation with type=route, route=bus and ref and operator tags. The ways over which the bus travels would be members, along with bus stop nodes. The ways would have forward or backward roles, depending on whether the buses operate in the direction of the way, or the opposite way (or the role might be blank, meaning the bus route uses the way in both directions).
Multi-polygon
In the multipolygon relation, role=inner and role=outer are used to specify whether a way forms the inner or outer part of that polygon.
See also
| Data Primitives | |
|---|---|
| Node • Way • Relation • Tag | |