Skip to content
GuidesBlogPlaygroundDashboard

OSM Data Model

How OpenStreetMap structures geographic data and how Plaza exposes it through the API.

Plaza includes the full OpenStreetMap (OSM) planet as one of its core data sources. Understanding how OSM models the world helps you write better queries and interpret results when working with OSM data.

Everything in OSM is one of three types.

A node is a point on the map — a single latitude/longitude pair. Nodes represent discrete things: a cafe, a bench, a traffic light, a tree, a summit. There are roughly 8 billion nodes in the OSM planet.

Many nodes exist only as coordinates in a way (see below) and have no tags of their own. A node with tags is a point of interest.

A way is an ordered list of nodes forming a line or shape. If the first and last node are the same, it’s a closed way — usually representing an area (a building, a park, a lake). If they differ, it’s an open way — usually a road, path, river, or wall.

There are roughly 1 billion ways in the planet.

A relation is a group of nodes, ways, or other relations with assigned roles. They model things that can’t be expressed with a single way:

  • Multipolygons — A lake with islands, a building with a courtyard.
  • Routes — A bus line, a hiking trail spanning many ways.
  • Boundaries — Administrative borders (country, state, city).
  • Turn restrictions — “No left turn from way A to way B via node C.”

There are roughly 15 million relations in the planet.

Tags are how OSM describes what things are. Every element can have zero or more tags, each a key=value string pair.

Some common keys:

KeyExample valuesWhat it describes
nameTour Eiffel, BroadwayThe name of the thing
amenitycafe, hospital, schoolPoints of interest
highwayresidential, motorway, footwayRoads and paths
buildingyes, apartments, churchBuildings
shopsupermarket, bakery, clothesRetail
naturaltree, water, peakNatural features
opening_hoursMo-Fr 09:00-18:00Operating hours
cuisineitalian, sushi, burgerRestaurant food type
addr:streetRue de RivoliStreet address
addr:housenumber42House number

Tags are freeform — anyone can use any key. In practice, the community follows conventions on the OSM wiki. For real-world usage stats, check taginfo.openstreetmap.org.

Every element has a numeric ID unique within its type. Node 123 and way 123 are different things. The pair (type, id) is globally unique.

IDs are assigned sequentially and stable through edits. Deleted elements leave gaps — don’t assume IDs are contiguous or that higher IDs are newer.

Plaza returns OSM data as GeoJSON Features. Tags are flattened into properties alongside @type and @id:

{
"@type": "way",
"@id": 123456789,
"building": "yes",
"name": "Musée du Louvre",
"tourism": "museum",
"wikipedia": "en:Louvre"
}

The geometry type depends on the element:

OSM typeGeoJSON geometry
NodePoint
Way (open)LineString
Way (closed)Polygon
Relation (multipolygon)MultiPolygon
Relation (route)MultiLineString
Relation (other)GeometryCollection

Most endpoints accept tag filters via bracket syntax — filter by key existence, exact value, or regex:

Terminal window
# All cafes within a bounding area
curl -X POST https://plaza.fyi/api/v1/features \
-H "x-api-key: pk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"within": {
"type": "Polygon",
"coordinates": [[[2.33, 48.85], [2.35, 48.85], [2.35, 48.87], [2.33, 48.87], [2.33, 48.85]]]
},
"type": "node",
"tags": { "amenity": "cafe" }
}'
# All buildings with a name
curl -X POST https://plaza.fyi/api/v1/features \
-H "x-api-key: pk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"within": {
"type": "Polygon",
"coordinates": [[[2.33, 48.85], [2.35, 48.85], [2.35, 48.87], [2.33, 48.87], [2.33, 48.85]]]
},
"type": "way",
"tags": { "building": "yes", "name": "~." }
}'

"amenity": "cafe" means “has amenity tag with value cafe.” Use "name": "~." for regex matching (here, any non-empty name value). Multiple tag filters are ANDed together.

Workflow: find tags on taginfo, test a small query with Plaza, then scale up.