drolbr / Overpass-API

A database engine to query the OpenStreetMap data.
http://overpass-api.de
GNU Affero General Public License v3.0
710 stars 90 forks source link

Feature Request: get the surrounding building for a given node #542

Open rriemann opened 4 years ago

rriemann commented 4 years ago

Dear all,

after I have received no input on my question on help.openstreetmap.org I wonder if the overpass-api currently allows for it. So I file it here as a feature request for discussion. Maybe there is also a work around involving other tools than overpass. Please let me know.

Related issue request: https://github.com/drolbr/Overpass-API/issues/285

I want to query overpass-turbo.eu for all buildings that contain at least one node with the tag "country=EU" and "office=government".

I tried so far:

node({{bbox}})[country=EU][office=government];
is_in;
(way[building](pivot);>;);out;

Test on overpass: http://overpass-turbo.eu/s/MaJ (courtesy of mmd)

However, this does not work as areas are not always updated (see discussion with mmd and on github). The results are not complete and not reliable.

Then, I tested to achieve this with the around operator.

[out:json][timeout:25];
// fetch area “Brussels” to search in
{{geocodeArea:Brussels}}->.searchArea;
// gather results
node[office=government][country=EU](area.searchArea)->.offices;
( 
  way[building=yes](around.offices:8);
);
// print results
out body;
(._;>;);
out skel qt;

Test on overpass: http://overpass-turbo.eu/s/Mbp

However, here I do not know how to choose the distance of the around operator. The results are either incomplete or I get false positives, i.e. also neighbouring buildings.

So if this query is currently not possible, I suggest to introduce a feature that allows to give for a node an array of surrounding paths.

mmd-osm commented 4 years ago

Related: ad hoc area generation in #77