Overpass query to get the id of country boundaries

I am trying to get the ids of the closed boundaries of all countries (one relation id for each country).
Until now, I have this overpass query:

[out:csv(::id)];
(
  relation["boundary"="administrative"]["admin_level"="2"];
);
out ids;

However, there are some “boundary” relation sections in some countries (France, Germany, Spain) that are affecting the list (relation ids: 102666, 51239, 90333, 90340, etc.).

How can I identify the relation for each country? I have also tried the isClosed function, but probably I didn’t use correctly.

3 posts - 3 participants

Read full topic


Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/overpass-query-to-get-the-id-of-country-boundaries/4873