List of countries and their regions

Hi,

New to the forum!

I am working on a project where I have biking routes from all over the world (I only have the coordinates).
I would like to make a nice catalog where I group these biking routes by country and region, so I thought of using data from OSM to achieve this.

So far my idea is to use Overpass data, to find all relations with tags [“admin_level”=“2”] and [“boundary”=“administrative”] , like this: overpass turbo . The second step would be to iterate over them ant obtain the relations with the lower level and then recursively continue until I am done.

The problem I ran into is that this works for some countries (Australia), but for others like Denmark (overpass turbo) or Germany I get no results on the second query.

What am I doing wrong? Also, am I reinventing the wheel? I have found other resources such as GitHub - nzzdev/osm-regions: Extract region geometries (ISO 3166 countries and subdivisions) from OpenStreetMap in order to create a region dataset compatible with OpenMapTiles., but they don’t use all admin_levels available.

Thanks in advance,
Álvaro

PS: I have a few more examples, but I could only add 3 links.

3 posts - 2 participants

Read full topic


Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/list-of-countries-and-their-regions/105200