A way is one of the fundamental elements of the map. In everyday language, it is a line. A way normally represents a linear feature on the ground (such as a road, wall, or river).
Technically a way is an ordered list of nodes which normally also has at least one tag or is included within a Relation. A way can have between 2 and 2,000 nodes, although it's possible that faulty ways with zero or a single node exist. A way can be open or closed.
As of August 2020, OpenStreetMap contains over 689 million ways.
Types of way
In an open way the first and last node are not identical. Common examples include most roads, streams and railway lines, because these start in one place and finish in another.
In the database, a way always has a direction. This is true even if the ground feature it represents is 'two-way' (e.g., most roads, where traffic passes in both directions) or has no direction (e.g., a wall). See here for how to identify the direction of a 'way'.
In a closed way the last node of the way is identical with the first node. A closed way may be interpreted either as a closed polyline, or as an area, or both, depending on its tags.
The following closed ways would be interpreted as closed polylines:
- highway=* Closed ways are used to define roundabouts and circular walks
- barrier=* Closed ways are used to define barriers, such as hedges and walls, that go completely round a property.
A closed way that has the tag area=yes should always be interpreted as an area (but the tag is not required most of the time: see 'area', below).
Overpass QL parameter/operator
is_closed Overpass_QL#Geometry_Related_Operators & example overpass-turbo query: Overpass_API/Overpass_API_by_Example#Limit_results_to_areas_only
- Main article: Area
An area (also polygon) is an enclosed filled area of territory defined as a closed way. Most closed ways are considered to be areas even without an area=yes tag (see above for some exceptions). Examples of areas defined as closed ways include:
For tags which can be used to define closed polylines it is necessary to also add an area=yes if an area is desired. Examples include:
Combined closed-polyline and area
It is possible for a closed way to be tagged in a way that it should be interpreted both as a closed-polylines and also as an area.
For example, a closed way defining a roundabout surrounding a grassy area might be tagged simultaneously as :
- highway=primary + junction=roundabout, both being interpreted as a polyline along the closed way, and
- landuse=grass, interpreted on the area enclosed by the way.
Street as a vector
<way id="5090250" visible="true" timestamp="2009-01-19T19:07:25Z" version="8" changeset="816806" user="Blumpsy" uid="64226"> <nd ref="822403"/> <nd ref="21533912"/> <nd ref="821601"/> <nd ref="21533910"/> <nd ref="135791608"/> <nd ref="333725784"/> <nd ref="333725781"/> <nd ref="333725774"/> <nd ref="333725776"/> <nd ref="823771"/> <tag k="highway" v="residential"/> <tag k="name" v="Clipstone Street"/> <tag k="oneway" v="yes"/> </way>
The nodes defining the geometry of the way are enumerated in the correct order, and indicated only by reference using their unique identifier. These nodes must have been already defined separately with their coordinates.