I’ve dabbled with overpass turbo on and off for maybe a year now, but I feel like I’ve just now started to get a better understanding of how it works.
I’ve been using it to find hikes that can lead to ruins or abandoned places:
(
nwr['abandoned']({{bbox}});
nwr['historic'='ruins']({{bbox}});
);
out;
and for campsites:
(
nwr['tourism'='camp_site']({{bbox}});
nwr['tourism'='camp_pitch']({{bbox}});
);
out;
And while those are certainly useful, especially for hard to find places that won’t show up on AllTrails or other popular spots, I didn’t feel like I learned much since they’re fairly simple queries.
The way I understand it at the moment: the Overpass query language treats things as sets. There is a default set (named “_”) that gets populated with the queries.
In the case of the camping, there are two lines enclosed in parentheses which groups the two requested object sets as a union (or OR operation) to store in the default set which is then output with the “out” statement
The “nwr” is a shorthand for “node” “way” “relation” so it indicates what kinds of objects we’re looking for (we could replace it with any one type depending on what we’re looking for).
The ({{bbox}}) portion indicates where to look for the objects, {{bbox}} is a predefined area based on the overpass turbo site’s map, otherwise it should be set to a 4-value array indicating the borders of the area to search (read more here)
Let’s break down the next query I’ve found to be very useful, finding local cafe’s! (Google’s results have been getting pretty bad and overlooking a bunch of great options)
[out:csv(
name,
"addr:housenumber",
"addr:street",
"addr:city",
website;true;",")];
nwr['amenity'='cafe',i]["name"!="Starbucks"]({{bbox}});
out;
There’s a couple familiar things there: “out”, “({{bbox}})”, and “nwr”
nwr['amenity'='cafe',i]["name"!="Starbucks"]({{bbox}});