I have a simple overpass query based on is_in that does half of what I need - finds an area tagged as a building if one surrounds my input co-ordinates. So here's what the query looks like for "The Shard" in London: is_in(51.5041386,-0.0862526); foreach(area._["building"];out;); I'd like to also pull back the full geometry (ways and nodes) of the outline (indeed it'd be nice for this to work for buildings made as relations too, but let's not be greedy just yet). It seemed like one of the recurse options might do that, but I tried all I could think of to no avail. I'm guessing I'm missing an important piece. Can anybody show me what? Thanks! |
I'm sorry, there exists no direct implementation yet for this feature. However, there are two effective workarounds for this: You could query the ways that are inside the area and have appropriate tags:
As buildings usually don't overlap, this should almost always return the right object. And it would work for relations as well if there were any:
The downside is that this doesn't work properly with terraced houses, because the neighbouring house is considered as inside the area if it touches the area with a complete edge. The second workaround would be to evaluate the area id: - An area with an id between 2.4 billion and 3.6 billion is always created from the way with area id minus 2.4 billion. - An area with an id of more than 3.6 billion is always created from the relation with area id minus 3.6 billion. You would have to do two requests to use this workaround: the first fetches the ids, and then the second, like
fetches the actual geometry. As this could be easily done on the server, I'll include a command for this workaround in the next version. This would also be sustainable if the numbering scheme for areas changes in the future. I'll post details here once a beta version is operational, in a couple of days. 1
Helps a lot, thanks! I modified my basic query to this:
This does something very like what I want:
Open question: the revised query above will match only building ways, not relations. I can run a second copy, but is there a nice way to also include relations in the same query?
(21 Feb '13, 10:36)
mackerski
This answer doesn't seem to work any more? Trying this query on the Overpass Turbo site (http://overpass-turbo.eu/s/jxk), it returns an empty set. The original question's query does return the appropriate
(21 Oct '16, 21:56)
Midnightligh...
Please try
(22 Oct '16, 09:10)
Roland Olbricht
|