NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Dear all,

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.

Is there a solution to get the surrounding building of a set of nodes with specific tags?

asked 09 Sep '19, 18:48

rriemann's gravatar image

rriemann
26113
accept rate: 0%

Is it maybe possible to have a foreach loop over all government office and use their geographical location to get all elements on that point (it's possible with the openstreetmap.org context menu query) and then filter out one building?

(10 Sep '19, 09:17) rriemann
1
(20 Sep '19, 22:49) rriemann
1

Is there maybe a work around in a different language? With some python/javascript lib?

(07 Oct '19, 21:19) rriemann

Has a nice code example that can be useful: https://pypi.org/project/osmxtract/

(09 Nov '19, 22:22) rriemann

This is my best take so far:

[out:json][timeout:25];
{{geocodeArea:Brussels}}->.searchArea;
// get EU governmental offices nodes
node[office=government][country=EU](area.searchArea)->.offices;
(
        // get all enclosures from EU governmental offices
        .offices is_in->.enclosing;
        // limit result to buildings
        way(pivot.enclosing)[building=yes]->.officebuildings;
);

.officebuildings out geom;
.offices out meta;

Run in overpass turbo: http://overpass-turbo.eu/s/NID

The problem is yet that some buildings are not marked (most of them?).

permanent link

answered 04 Nov '19, 18:53

rriemann's gravatar image

rriemann
26113
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483

question asked: 09 Sep '19, 18:48

question was seen: 2,085 times

last updated: 09 Nov '19, 22:22

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum