This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Find and get boundary for admin_level=4 territory

0

Hi. Have some questions:

  1. Can i get list of admin_level=4 territories?
  2. How to get selected territory boundary via osm_id or something like that?

asked 05 Jun '23, 09:35

Dmitry2023's gravatar image

Dmitry2023
11112
accept rate: 0%

edited 05 Jun '23, 11:32

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866


One Answer:

0

To reply to point 1:

If you want all of them you can use sophox with the following query:

SELECT ?bound ?name ?wikidata WHERE {
  ?bound osmt:admin_level "4" .
  ?bound osmt:type "boundary" .
  ?bound osmt:name ?name .
  ?bound osmt:wikidata ?wikidata
}

Try it

Or with overpass if you want a bounding box selection with the query:

[out:json][timeout:25];
// gather results
(
  relation[admin_level=4]({{bbox}});
);
// print results
out body;
>;
out skel qt;

Try it

With overpass you can download the result of the query in different formats using the button "Export" which maybe replies to point 2.

answered 07 Jun '23, 10:09

ernsterwinwg's gravatar image

ernsterwinwg
112
accept rate: 0%

edited 07 Jun '23, 10:24

Source code available on GitHub .