“Bingo!” Bob says as he walks towards the restaurant.
See how powerful the Overpass QL is in querying OSM data? It has a plethora of different filters and statements, and combining them with each other can create even more specific queries for your use cases.
Our previous example introduces a very important metaphor in the Overpass Query Language, which is ‘flow’. A good way to think of the Overpass API is that it allows OSM data (nodes, etc.) to be generated and modified as it ‘flows’ from one statement to another.
As a concrete example, our bounding box query (the lat/lon points) finds the nodes in that area. The resulting data will then ‘flow’ and get filtered [natural=tree]
, [height=20]
, etc.
If you notice, (around:n)
works the same way, in that our initial data flows in it, and gets modified to show the nodes around the initial data that is produced by our first line.
“Wow!” Bob exclaims, “That was a very good meal!”
“That would be 25 Euros sir” says the waiter, dressed in an all white attire.
“Coming right up!” Bob says proudly, when…
“Uh oh! I seem to have left my wallet at the observatory!”
Flustered, Bob ran outside the restaurant, hoping to get back to his wallet.
out
statements, with a blank line in between them. Overpass QL can use multiple out
statements. If you think of QL statements as sentences, you can think of our structure here as two different paragraphs. Our first ‘paragraph’ is the query we’ve been using so far, and only prints the restaurant where Bob is. The second ‘paragraph’ is what you need to edit.["tower:type"=observation]
for this. Note how we surround the filter type with quotation marks - we do this since it contains a non alphabet character (namely :
)area
. Since we know that the tower is in a particular area (Inn River), we can use that info in making our query.area
keyword. This is just like the keyword node
we have used so far, but instead of querying for a single point of interest like a node, area
queries for a… well, an area![name=Inn]
as a filter in the area
statement.node
statement, along with the tower type filter discussed in 3.node
statement to node(area)
. This tells overpass to only query for nodes inside the area you defined on the area statement!