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

Can I use Overpass-API to get all administrative entities enclosing (partially or completely) an object. i.e. I have a wood like Sarghai (https://www.openstreetmap.org/way/475130161) and I want to know that it lies at least partially within a national park (Nationalpark Harz) and Harz (LK Goslar) administrative boundaries and lower saxony. Best case would be a Overpass-API script where I can give a Node, Way or Relation and receive all enclosing administrative entities.

asked 08 Apr '20, 10:37

Ogmios's gravatar image

Ogmios
766202639
accept rate: 25%

1

Have a read up of 'is_in'

(08 Apr '20, 12:04) DaveF

Thanks DaveF, that was helpful. I just have to figure out how to use a node/way/rel instead of a coordinate but so far it works well:

[out:csv(::id, name)][timeout:25]; ( is_in(51.70785, 10.45692)->.a; / * boundary=national_park = Nationalpark * boundary=protected_area = Naturschutzgebiet * boundary=administrative = Landrkeise, Länder etc. / area.a ["boundary"~"national_park|protected_area"] ->.b;

area.a ["boundary"="administrative"] ["admin_level"!="2"] ->.c;

rel(pivot.b)->.b; rel(pivot.c)->.c; ); .b out geom; .c out geom;

(08 Apr '20, 17:47) Ogmios

// All boundaries enclosing an entity (forest)
way(475130161);
out geom;
(._;>;);
is_in;
rel(pivot)[boundary];
out geom;

https://overpass-turbo.eu/s/SAZ

permanent link

answered 08 Apr '20, 18:05

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 08 Apr '20, 18:23

Great, thanks.

(08 Apr '20, 20:01) Ogmios

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×483
×63

question asked: 08 Apr '20, 10:37

question was seen: 1,423 times

last updated: 08 Apr '20, 20:01

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