The following routine returns an itemised list, sorted based on the number of items, for the values of one specified tag (railway stations’ network tag in the example).
Is there a way to return a similar list but for all the stations’ tag’s key?
ie
[out:csv("Key","Value",count; false; ",")];
node[railway=station]({{bbox}});
for ->.k (keys())
{
.__->.vres;
for .k->.v (t[k.val])
{
make stat
Key=k.val,Value=v.val,
count=(v.count(nodes));
(._;.vres;)->.vres;
}
(.vres;.res;)->.res;
}
for .res (1000000 - t["count"])
{ out; }
The query has been changed into a two-level loop to iterate over both all keys and their values each. In addition the sorting mechanism is moved from the id to a loop in the end. Using the id has lots of collisions for overwriting existing objects which makes the result somewhat incomprehensible.