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

Overpass turbo query - OSM Cities in CSV with tags

0

I'm trying to run an Overpass turbo query of OpenStreetMaps Cities that will return the cities as CSV data with several fields (columns).

I'm currently able to get these fields:

Latitude, Longitude, Name, Population (plus any other simple tags of the nodes)

By running this query:

[out:csv(::lat,::lon,name,population)][timeout:300];
// fetch area to search in
{{geocodeArea:united states}}->.searchArea;
// gather results
(
  node[place="city"](area.searchArea)(if:count_tags() > 0);
);
// print results
out body;
>;
out skel qt;

But, I would like to also get these fields, and I have been unable to do so:

  1. Total number of tags associated with the node
  2. Name of the Country in which the node is located
  3. Name of the State in which the node is located

I know that data is there, because I can use both the country and tag count to filter the data, but I can't seem to get those as data in my CSV output.

Any help would be greatly appreciated!

asked 06 Jun '22, 22:35

salb1845's gravatar image

salb1845
11112
accept rate: 0%