NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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?

rel(62149); //UK
out geom;

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?

rel(58447); //England
out geom;

This seems excessively slow and many queries. What can be optimized?

asked 11 Aug '21, 10:04

Seraphis's gravatar image

accept rate: 0%

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 is recommended.

If you're after a list of names:

[out:csv(name,::id; false; ",")];
area(3600058447); //England
out tags;

3600000000 is the start number for relation's ids

RegEx can be used to search for different admin_levels in one call.

[out:csv(name,::id; false; ",")];
area(3600062149); //UK
out tags;
permanent link

answered 11 Aug '21, 13:26

DaveF's gravatar image

accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 11 Aug '21, 10:04

question was seen: 1,845 times

last updated: 11 Aug '21, 13:26

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum