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}});
translates to “find all nodes, ways, and relations where the tag “amenity” equals “cafe” (“i” indicating case insensitive), AND the tag “name” does not equal “Starbucks”, found within the default bounding box”
The prior lines are a bit more daunting, but really simple, they just define the output formatting for csv, indicating the columns (name, address, website), whether to show a header (“true”), and the separating character (“,”)
I’ve been using that not only to find local cafes, but quickly determine which ones are missing tags and update them accordingly. I haven’t used MapRoulette much, but I believe this is effectively a similar process.
Anyway, I’m excited to keep adding to the map so these tools become more powerful! Check out the API reference for more info, there’s not a lot of resources, but they’re there, and I think as more data gets added, the more popular the tools will become (especially if the other big companies keep shooting their feet)
I think it’d be neat to have a search engine of sorts where one could put in plain text what they’re looking for on the map, and it could spit it back. For example:
Find all hotels with a swimming pool
Could generate
nwr['leisure'='swimming_pool']({{bbox}})->.pools;
nwr(around.pools:15)['tourism'='hotel']({{bbox}});
(._;>;);
out;
with a nice interface to display more data. An actual use-case for AI perhaps
Discussion