Overpass query example

Export results as CSV

Get a spreadsheet instead of JSON with [out:csv]: choose the columns, header and separator. Example: hotels in Geneva.

[out:csv(…)] returns a table: one row per element and one column per field you list. It is the fastest way from Overpass to Excel, Google Sheets or pandas.

The query

[out:csv(::id, name, stars, "addr:street", ::lat, ::lon; true; ",")][timeout:60];
area["name"="Genève"]["admin_level"="8"]->.a;
nwr["tourism"="hotel"](area.a);
out center;

Run it

Running the query…

Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).

How it works

  1. The list in out:csv(…) names the columns: tag keys, or special fields like ::id, ::type, ::lat and ::lon.
  2. Quote keys with a colon, like "addr:street".
  3. true prints a header row; "," sets the separator (the default is a tab).
  4. With out center;, ::lat and ::lon are filled for buildings too.

Variations

  • Load it in pandas: pd.read_csv(url_with_query).
  • Other metadata fields: ::user, ::version, ::timestamp.

Run it from your code

curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
  --data-urlencode 'data@query.overpassql'

Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.

More examples

All examples →