Hey all,

whilst I thought I was somewhat getting the hang over the Overpass API, a fairly basic usecase has me stumped!

I want to extract the enclosing administrative boundary when providing a lat and long, looking to extract levels 10, 9 and 8.

I have been able to extract all surrounding relations by doing the following query, which pulls back far too much information including the county, country and UK as a whole:

   [timeout:25][out:json];
    is_in(52.0246,0.80801)->.a;way(pivot.a);out tags ;relation(pivot.a);out tags bb;

I have tried to limit the results with:

area['admin_level'='10'];

and various relations but that hasn't limited the results at all. Could someone please help? Much appreciated!

asked 14 Jul, 20:51

nikotime's gravatar image

nikotime
162
accept rate: 0%


If you want only those relations tagged with admin_level=10 you can say it when requesting them:

[timeout:25][out:json];
is_in(52.0246,0.80801)->.a;
relation(pivot.a)[admin_level=10];
out tags bb;

If you want even those with admin_level 8 and 9 then the code gets slightly larger:

[timeout:25][out:json];
is_in(52.0246,0.80801)->.a;
relation(pivot.a)(if:t["admin_level"]>=8 && t["admin_level"]<=10);
out tags bb;
permanent link

answered 15 Jul, 11:57

MarcoR's gravatar image

MarcoR
6123718
accept rate: 27%

Thats absolutely spot on. Thanks so much Marco for your help!

(16 Jul, 08:16) nikotime
Your answer
toggle preview

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:

×178
×60

question asked: 14 Jul, 20:51

question was seen: 74 times

last updated: 16 Jul, 08:16

powered by OSQA