Use Overpass API to output different tag counts as CSV

I want to create CSV data with different OpenStreetMap tag counts for selected cities using Overpass API. Unfortunately, the “Counting Objects” section of the Overpass API Documentation is still empty. Also, this count function documentation only shows how to count nodes, ways, relations or a combination for a single tag query.

How can an output containing several columns for different tag counts be achieved?

I found this helpful example for counting pharmacies.

And this is what my query currently looks like:

// Define fields for CSV output
[out:csv(name, "node[railway=station]", "node[highway=bus_stop]")];

// Select area

// Query stations and bus stops
//node(area.regio)[highway=bus_stop]; // How can this count be added separately?

// Count stations
make count name = munich.set(t["name"]),
           "node[railway=station]" = count(nodes);

// Output CSV

If I uncomment the node(area.regio)[highway=bus_stop]… line, only the bus stop count is contained in the output, but should appear in an additional column next to the railway station count.

Please note: This question has originally been posted at GIS StackExchange.

2 posts - 2 participants

Read full topic

Ce sujet de discussion accompagne la publication sur