This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to download buildings that do not have a tagged node on the building way?

1

I want to use a JOSM overpass query to exclude from a "building=" download all buildings that have an "entrance=" node that has "addr:housenumber" or "addr:street".

.

asked 14 May '19, 12:33

Alan01730's gravatar image

Alan01730
464343552
accept rate: 0%


One Answer:

5

Here's a basic sketch of how to do it:

[bbox:{{bbox}}];
// find buildings
way[building]->.buildings;
// nodes that are part of a building that also have an entrance tag
node(w.buildings)[entrance]->.entrances;
// buildings that have entrances
way(bn.entrances)[building]->.entranced;
// the difference between the sets
(.buildings; - .entranced;);
out geom;

You can see that the Walmart in the bounding box is not in the result set, as it does have an entrance. You'll need to add some rules to deal with the requirement for an address component and you might want to handle relations in addition to ways, but the basic pattern is to find the buildings, use the node recursion filter to find the entrances, use the way (and maybe relation) recursion filters to find the buildings those nodes are members of, and then take the difference between that and the initial set of buildings.

answered 15 May '19, 02:35

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thanks @maxerickson that's a great answer, especially with the sample code. You are a good teacher. I always knew I'd have to learn more than just the "Wizard"

(15 May '19, 21:38) Alan01730

Source code available on GitHub .