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

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%


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.

permanent link

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

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:

×622
×483

question asked: 14 May '19, 12:33

question was seen: 1,645 times

last updated: 15 May '19, 21:38

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