I would like to be able to click on a building on a map and get the polygon that comprises the building at the clicked coordinate.
I looked into overpass api and tried the following:
<query type="way">
<around lat="51.0566036" lon="13.7181033" radius="30"/>
<has-kv k="building"/>
</query>
<union>
<item/>
<recurse type="down"/>
</union>
<print/>
If I choose a large radius
I get too many buildings. If the radius
is too small I don't get any buildings. Using bbox-query
did not help.
I also tried coord-query
, but I was not able to construct a meaningful query. The necessary query syntax seems to be different.
Is there a better approach at hand? Even withouth overpass, I have just to look into it.
What you try to realize is a 'reverse geocoding'. To avoid the mentioned problems (AFAIK) usual implementations use an arbitary radius and then test the resulting shapes once more if they contain the desired position.