Hello, I am fairly new to overpass but I attempt to do a tree traversal of boundaries of admin_levels for a given country. For example: For UK, I want the UK border. Then on next level the borders of Wales, England, Scotland, Northern Island. Then on next level, for example inside England, I want the regions of England. Etc. At the end I would have a tree structure. I don't need to have all data all at once, but would be sufficient to get the data admin_level by admin_level. I see 2 issues I am currently blocked. First, I get the borders of 4 countries in UK. Can this query be optimized? I also get the nodes (capital), but I am only interested in the borders?
Second, how do I get the children for a given country? I could increment the admin_level but some admin_levels are not used. Is it better to query for admin areas inside an area?
This seems excessively slow and many queries. What can be optimized? |
Unsure what you want your output to contain or what you want to use it for, but that would large amounts of data put a lot of strain on OP servers. If you're after full data https://osm-boundaries.com/ is recommended. If you're after a list of names:
3600000000 is the start number for relation's ids https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_element_id RegEx can be used to search for different admin_levels in one call.
|