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
23  Finding the areas enclosing a feature
Sometimes we want to find the area that encloses some features of interest. For example, finding the administrative area for a firestation. Or the park that contains a play area.
This query demonstrates how to find the area that encloses a point using the
is_in
statement.
The is_in
statement allows us to find areas based on some previously found
nodes, ways or relations..
The first part of our query finds the area that contains the summit of Uluṟu:
node["name:pjt"="Uluṟu"]>.summit;
.summit is_in >.someArea;
A named result set (summit
) is used here to make things clearer. We first store
the node(s) we found in a variable called summit
.
Then we use is_in
to find which areas contain those elements. This will be ALL
the areas that cover that point. Not just the boundary of Uluṟu, but also
that of the UluṟuKata Tjuṯa National Park, Petermann, the Macdonnell Region and so
on all the way up to Australia.
is_in
returns the full spatial coverage starting from one or more features.
The Overpass API will give us the tags associated with areas, but not their geometry.
If we want that, then we need to find the original ways or relations from which the area was created.
We do that by applying the pivot
filter. This filter finds the corresponding OSM
database feature for an area (or areas) in our result set.
In our example query we find the way
that corresponds to the area surrounding
the summit of Uluṟu like this:
way(pivot.someArea);
If we'd instead wanted to find a relation, then we would have used:
relation(pivot.someArea);
Source File  23areasfromfeatures.osm 
Authors 
