I have a simple Overpass XML query, and I'd like to restrict it to search in a manually-specified polygon (NOT to an existing area in OSM). The documentation mentions how to select region by polygon but it doesn't tell me what to use instead of (My use-case: selecting e.g. all the lighthouses in mainland Britain. There are few enough lighthouses that it's OK to query such a big area, but the coast of Britain is far too complex to try and load into the Overpass interpreter so I drew a simplified outline.) Here is my bbox query, which easily gets all the lighthouses in mainland Britain, but with a couple of extras from Ireland and France:
and here are my simplified coordinates, just manually drawn:
asked 26 May '14, 14:54 mcld |
It does tell you what to use, but not as you seem to expect. Overpass has two different query language formats: XML and its own language QL. The select region by polygon example query is written in QL but you seem to prefer the XML version. In that case just paste the code into the Overpass API convert form where you can convert between different formats. Converting the example query to XML will result in:
answered 26 May '14, 15:14 scai ♦ |
Just to spell it out after @scai answered, here is exactly the Overpass XML that carries out my desired query:
permanent link
This answer is marked "community wiki".
answered 26 May '14, 15:19 mcld |
Why can't you use an existing area - or - combine several existing areas to the one you're looking for? Manually specifying coordinates looks a bit cumbersome to me.
This works better for me. I could use an existing area, but the geometry for the UK has so much detail that the Overpass query takes a long time to run.
This query for United Kingdom based on areas takes just 20s. That's why I thought it's not really worth the effort: http://overpass-turbo.eu/s/4m3
That query does not do what I need. Thanks though.
Right. I didn't spend much time trying to find a matching relation, so the result includes more data than just mainland Britain. But that's absolutely expected behaviour (sorry for being a bit lazy on a Sunday morning :)
My point was: performance wise there's really no heavy penalty in using even a complex geometry originating from existing areas.