Igor's Techno Club

Show Cafes Around the Pantheon in Rome with OSM Overpass Turbo

Screenshot 2024-09-02 at 15

Overpass Turbo is a tool to query OSM data by writing queries using their own DSL language. For example, Trevor Rainbolt (the guy who won Geoguessr) uses this feature as well, so I think more people should know about it.

Let say, you want to show all cafes around the Pantheon in Rome. The query is easy one, only if you know how to translate an ask to the proper DSL, and without proper knowledge how OSM handles nodes and it's meta information, it could be quite a task for some. This is where LLMs can help you with such a task (I used GPT-4 here, but almost all popular LLMs can handle it):

(user)

Write a Turbo Pass query to get all coffee shops 100m around the Pantheon in Rome.

(Chat-GPT)

Certainly! Here's a refined query specifically designed for use in the Overpass Turbo interface to find coffee shops within 100 meters of the Pantheon in Rome:

[out:json][timeout:25];
// Define the center point for the Pantheon
{{geocodeArea:Roma}}->.searchArea;
node(around:100, 41.8986, 12.4768)["amenity"="cafe"];
out body;
>;
out skel qt;

How to Use This Query

  1. Open Overpass Turbo.
  2. Paste the above query into the query window.
  3. Click the "Run" button.

Query Explanation

  1. out:json - Specifies the output format as JSON.
  2. [timeout:25] - Sets a timeout of 25 seconds for the query to run. Adjust as necessary.
  3. {{geocodeArea:Roma}}->.searchArea; - This line is a placeholder to define the search area automatically for Rome, though it is not strictly necessary for the bounding box query.
  4. node(around:100, 41.8986, 12.4768)["amenity"="cafe"]; - This line specifies that we're looking for nodes (points) tagged with amenity=cafe within a 100-meter radius around the coordinates 41.8986, 12.4768.
  5. out body; - Outputs the main elements.
  6. >; - Fetches associated child nodes.
  7. out skel qt; - Returns the nodes and ways in a form optimized for quick tile creation and processing.

By running this query in Overpass Turbo, you'll get a list of all the coffee shops (cafes) within 100 meters of the Pantheon in Rome. The map will display the locations and you can further explore or export the data as needed.

#osm #til