Hello, I have found the website "OSM Boundaries Map 4.1" on https://wambachers-osm.website/boundaries/, it shows exactly what I would like to perfom with its exploring tree: for a given country I would like to get all the lower admin_levels and their administrative boundaries. So I tried to find the queries allowing me to get the boundaries for each admin_level of a given country. From levels 2 to 4 it's ok and quite simple, I came succesfully to the generic query:
But after that I encounter two issues: - I can't find a generic query effective for all the countries - I can't link lower admin_level to its upper admin_level (or inversely) Indeed, from level 5 I can't find any generic query I could use in any country. Indeed the different countries in the world will have specific tags in their admin_levels or won't have tag at all identifying the country. For example admin_level=5 "Greater London" in England doesn't have any tag identifying the country or upper level identification. Admin_level=6 "London" has the following tag to identify "is_in:iso_3166_2"="GB-ENG", but admin_level=6 "Nord" in France has a different tag: "ISO3166-2", not the "is_in" tag. Last example, for all cities in France (admin_level=8), I can't find any tag linked to the country or at list the upper level. I found out that some levels has a "subarea" mentionned, but it's not in all levels. The only solution I have at the moment is to search all boundaries whose the "admin_center" is in the upper boundary, but it's very heavy to perform on all admin levels of all countries... Do you know how I can get all administrative boundaries of all admin_level of a given country? Thanks asked 14 Feb '17, 18:07 thomas_bilendi Frederik Ramm ♦ |
Trying to do that with Overpass is probably not a good idea as you rely on structures that may or may not be there (even the admin_centre is not guaranteed to be set). Did you notice the wno-edv-service.de web site has a download option? I'd recommend loading the OSM data for your area of interest into a database with osm2pgsql (you can use a much reduced style file on import if you're only interested in administrative areas). After that, you can use the power of PostGIS to answer questions like "give me all admin boundaries that are inside this polygon" and so on. And you can easily export to GeoJSON or Shape files. answered 14 Feb '17, 18:29 Frederik Ramm ♦ Hi Frederik, Yes I have seen the download section, but since this service is kindly provided by a private individual, it could stop at any moment. So this is why I wanted to be able to query myself directly osm data. Indeed, I could load the osm data for my area into my postgis db then query it, but this is a huge amount of data and that's why I try to find the query to download only admin_levels (I will have to download data every month). After that, as you said, I can use PostGIS and query the imported boundaries.
(15 Feb '17, 10:46)
thomas_bilendi
|
For a country where it works (i.e. Denmark) you can try answered 14 Feb '17, 20:32 Hjart Hi Hjart, Yes I can, but its not the same for every country, and even in Denmark some admin_levels (e.g. admin_level=7) don't have that country tag (specific example: rel(2190242). So what I try to find is how the admin_levels are linked to each other
(15 Feb '17, 10:53)
thomas_bilendi
|
This website presents the boundaries hierarchically using admin_level: https://osm-boundaries.com answered 27 Apr '22, 10:42 pcgomes |
crosspost: https://stackoverflow.com/questions/42257339/openstreetmap-getting-administrative-boundaries-of-a-given-country-for-all-its
Have you solved this problem since then?