This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Overpass: export data as simplified list in CSV with lat and long?

1

I'm trying to create a liste with overpass so i can create my own map with http://printmaps-osm.de/de/beispiele.html

One example is using csv containing

id|name|wkt
1|Open Air Museum|POINT(7.59918 51.95005)
2|Zoo|POINT(7.59074 51.94666)

Is it possible to get this output instantly(or, something like that)? It feels like an simple request but i could not find it on https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Exporting_Data there or in the docs itself.

[out:csv("id","name","website","long")][timeout:25];
//[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=hospital”
  node["amenity"="hospital"]({{bbox}});
  way["amenity"="hospital"]({{bbox}});
  relation["amenity"="hospital"]({{bbox}});
);

// print results
out body center; // just get center of values
>;

I added "website" for testing purposes. So i can access tags, but i cannot access lat and long to write in the csv?

asked 19 Dec '21, 22:03

Negreheb's gravatar image

Negreheb
129127
accept rate: 0%


One Answer:

2

https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#CSV_output_mode

[out:csv(::id,name,website,::lat,::lon; false; ",")]
[bbox:{{bbox}}];
nwr[amenity=hospital];
out center;

https://overpass-turbo.eu/s/1ej9

answered 20 Dec '21, 03:31

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Source code available on GitHub .