“Oh! I see that building!” Bob exclaims. “So the ATM is just on the other side, yes?”
As Bob walked to the building, he realized one important thing - he didn’t know where the entrance is! Looks like we need to write another query for him!
With the existing query, we’ve successfully found the building, but we need to further locate a specific point - the building’s entrance.
A building, since it’s generally a polygon when viewed from the map, is defined as a way
. However, an entrance is usually just one point in the map - a point with a specific location. So how do you think they are represented in Overpass? If you’ve guessed by node
s, then you’ve guessed right!
Remember when I told you that way
s are just defined as an ordered list of nodes? Some of these nodes can be further tagged, taking different values such as entrances. In the next query, we’ll learn how to query for a specific node (an entrance) that is part of a way
.
node
that is part of a way
. The recurse
filter does just that - it allows you to find the node
from a way
.recurse
filter, you need to start with your target element, and a key for the source element inside parenthesis. In our example, our target element is a node
, while our source element is a way
, so we need to use the syntax node(w);
way
set is already available when we query for its nodes. So we need to place the query statement node(w)
after the way is set, but before the out;
statement.way
s are just a bunch of node
s, and with the recurse
filter, we showed these nodes instead of the actual way.recurse
filter recursed through the way
and returned the node
s that make it up, we still need to further filter the node
s to only show entrances. Luckily, we can use the filter [entrance=yes]
for that.node(w)
), a bare out
statement will work fine - make sure to remove the geom
modificator!