Overpass turbo: how do I get a CSV with ids of a class of relations?

I want a csv of all boundaries in the United Kingdom at admin_level=8, with columns for ‘name’ and ‘relation id’.

I’ve tried using the query given here, Overpass query to get the id of country boundaries

[out:csv(::id)] [timeout:500]; {{geocodeArea:United Kingdom}}->.searchArea; relation["boundary"="administrative"]["admin_level"="8"](area.searchArea); out ids;

That query returns a pure list of ids:
@id
17529
51781
51793
51805

This is not what I need.

If I modify the query to
[out:csv('name','type','::id',',')]
I get a result with a plausible number of lines (234), but entirely empty:

name type ::id ,

What are the magic words?

Test this

[out:csv(name,type,::id)] [timeout:32]; {{geocodeArea:United Kingdom}}->.searchArea; relation[“boundary”=“administrative”]“admin_level”=“8”;
out;

out ids; to simple out

2 Likes

Thanks very much.

If any other newbies try this, note that Discourse (this forum) changes the straight quotes required by Overpass into curly quotes. You have to change them all back again. :roll_eyes:

1 Like