Contribute to project
Intro

Way Node Recursion Improve page

“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 nodes, then you’ve guessed right!

Remember when I told you that ways 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.

Instructions
  1. The first thing we need to do is to query for a specific node that is part of a way. The recurse filter does just that - it allows you to find the node from a way.
  2. To do a 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);
  3. The very important metaphor of ‘flowing’ data still holds for this query. Because of this, we need to ensure our 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.
  4. If you try running the query now (seriously, go ahead!), you’ll see a bunch of nodes that define the look of our polygon. As told before, ways are just a bunch of nodes, and with the recurse filter, we showed these nodes instead of the actual way.
  5. While the recurse filter recursed through the way and returned the nodes that make it up, we still need to further filter the nodes to only show entrances. Luckily, we can use the filter [entrance=yes] for that.
  6. Since we changed our output result set from a way to entrances (with node(w)), a bare out statement will work fine - make sure to remove the geom modificator!
That doesn't seem right! Use node(w);
way["addr:city"=Passau][name="Wirtschaftswissenschaften (WIWI)"]; node(w)[entrance=yes]; out;