Overpass Tutorial
- 00 - The Beginning
- 01 - Finding nodes with a bounding box
- 02 - Outputting data about nodes
- 03 - Filtering nodes that have a tag
- 04 - Find nodes by matching tags and their values
- 05 - Find nodes by applying multiple filters
- 06 - Extracting multiple sets of nodes
- 07 - Calculating differences between results
- 08 - Generating JSON output
- 09 - Generating CSV output
- 10 - The default set
- 11 - Querying a set
- 12 - Searching within a radius using around
- 13 - Using around to filter against a set of results
- 14 - Searching by polygon
- 15 - Finding ways
- 16 - Ways and their nodes
- 17 - Ways and their tags
- 18 - Combining node and way queries
- 19 - Finding ways from their nodes
- 20 - Finding relations
- 21 - Type agnostic queries (nwr)
- 22 - Areas
- 23 - Finding the areas enclosing a feature
- 24 - Find the area derived from a feature
- 25 - Areas via Nominatim search
- 26 - Timeouts and endpoints
20 - Finding relations
Having looked at nodes and ways, the final part of the OSM data model we have to explore are relations.
Relations are collections of nodes and ways. They describe logical groupings of objects that go beyond their basic spatial relationship. For example a relation can be used to describe:
- a bus route, which connects a set of bus stop (nodes) and ways (the route)
- an administrative boundary
- a multipolygon, such as a collection of buildings that represent a single location
We query for relations using the relation
keyword, or its synonym (rel
).
We can apply filters based on tags, perform spatial queries as standard. And similar
to ways we will need to use the recursion operators (>
, >>
) to find their
geometries.
This query finds administrative boundaries within our bounding box.
Links | |
Source File | 20-relations.osm |
Authors |
|