Add key to admin_level relations that show they belong to previous level

Hello, what key I should add to the lower admin_level relations that show to which higher admin_level relation?

Example
Mozambique is divided in the following admin_level:

  1. Country
  2. Zones
  3. Provinces
  4. Districts
  5. Administrative Posts

I need to show in each relation to which higher relation they belong.

Any ideas?

Thanks

In general we don’t do this as it can easily be determined by inspecting the data using spatial queries.

For instance you can do an is_in query for a point in Overpass and this will return all areas encompassing the point. You can filter these by admin_level and sort by the value of admin_level where I think you can always assume a higher admin_level is a smaller unit than lower ones.

There is however a possibility to add subregions to an administrative boundary relation using the subarea role, but see the wiki.

1 Like

Thanks for the note but for someone that is not a OSM expert and is using the plataform to find information that is really to find in our context it would be great to have that possbility. Its similar to the addr:street, addr:district, addr:subdistrict you find in cities.

Will check the link.

Wikidata is likely to hold exactly this information in the form you expect, but you need to query it with SPARQL. OSM is a spatial database so it is bad practice to add information which can be retrieved using spatial queries, not least because when things change it will be wrong.

A quick check reveals that admin_levels 4 & 5 (presuming Zones and Provinces) are completely mapped on OSM, but 6 districts) is only present for one or two zones/provinces and 8 is mainly absent. You can explore the data using osm-boundaries.

3 Likes

There is however a possibility to add subregions to an administrative boundary relation using the subarea role, but see the wiki.

the explicit subarea mapping style is leading to needlessly swollen relations where simple queries e.g. for a country border lead to huge answers that contain all the lower boundaries inside it. It is a kind of is_in which we discourage for good reason https://wiki.openstreetmap.org/wiki/Key%3Ais_in

4 Likes

I have checked the osm-boundaries and its a great tool but I have added Mozambique - Cabo Delgado Province - Metuge and Chiure - all level 6 but they dont show on the tool, please advice.

Documentation answered - it takes 3 weeks to import and its on the phase of importing so the changes I day on the last few days wont show. Thanks to all for the insights