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:
I have tried to limit the results with:
and various relations but that hasn't limited the results at all. Could someone please help? Much appreciated! asked 14 Jul '21, 20:51 nikotime |
If you want only those relations tagged with admin_level=10 you can say it when requesting them:
If you want even those with admin_level 8 and 9 then the code gets slightly larger:
answered 15 Jul '21, 11:57 MarcoR Thats absolutely spot on. Thanks so much Marco for your help!
(16 Jul '21, 08:16)
nikotime
|
No requirement to store output in a variable (a) if only to be used once. Pivot will used the default output. Regex is used to filter the required admin_level. Note the 'something like' symbol. Pivot converts area to objects. Edit: To output just the tags there's no need to pivot
PS If you're just wanting to output a list, maybe take a look at answered 22 Aug '21, 18:50 DaveF |