Skip to content

The OpenStreetMap data model

Natasha96-Zhouner edited this page Jun 17, 2024 · 2 revisions

In OpenStreetMap, each feature is described as one or more geometries (think for instance of a river's shape) with attached attribute data (think of the river's name). Geometries are described with three different elements: nodes, ways and relations. Attributes are described as tags that can be part of a node, a way or a relation.

Nodes are the equivalent of a point, ways are like lines that connect points and relations are collections of points or ways that represent a larger whole. This is easiest to understand with a couple of examples.

Nodes

Nodes are used to represent any kind of point type feature or just to designate a name for a point of interest in the vicinity. Here's a node representing a café:

image

and here's one representing New York City:

image

Ways

A way is a line feature connecting two or more nodes - like a road here:

image

If you close a way - by connecting its end to its start, you can map area type features like this building here:

image

or this park:

image

Nodes are usually just the items that define a way. But nodes sitting on a way can have their own significance. In this example the node is part of 10th Street and M Street and it also denotes that there's a traffic light.

c8cb49c1-ed3c-4d79-91da-c07af6b4705d

Tags

Before we hop to the third element next to nodes and ways - relations, let's look at tags. You've seen them now already a couple of times in the examples above, like in this café node:

image

Any point type feature is a node. Whether the node designates a café, a school, a fire hydrant, a tree, a park, a mountain peak is entirely up to how the node is tagged. Any line type feature is a way. Whether the way is a road, a building, a lake, a railway, a cycleway is again, defined by how it is tagged.

Tags can be on any element: on nodes, ways and relations.

Relations

Relations are used to organize multiple nodes or ways into a larger whole. Take here for instance the bus route 23 running through 3 different ways.

87e5339f-f45c-4de9-95be-981f3b5a706d

The type of relation that you'll probably deal most with describes an area with punched out holes - a so called multipolygon. Here is an example of a multipolygon building with a yard. It consists of 2 ways with each multiple nodes. One way describes the outer wall of the building, the other one the inner wall. The ways are part of a relation of the type type=multipolygon, the outer way has the role outer and the inner way has the role inner. Note: the building=yes tag is on the relation (not on the way).

Your OpenStreetMap editor will take care of creating multipolygons for you so don't worry if this seems dense for now. If you need to fix a multipolygon, this is a good section to come back and review.

97cf8650-100a-4aa1-abfc-dac1aac6594f

Further reading

To learn more about the OpenStreetMap data structure, take a look at these resources:

Clone this wiki locally