How can I find nodes with "addr:housenumber" inside buildings with Overpass? I've found this snippet, but it doesn't work:

out meta;

asked 08 Oct '18, 16:40

Norske's gravatar image

accept rate: 0%

Just curious, why do you need this query?

(09 Oct '18, 07:51) scai ♦

Well, here's a script that will get you some results, but it isn't really correct:

out meta;

Some things to note:

  • Rather than just building=yes, I'm just checking if the building tag exists, so it will work with building=school, building=apartments, etc.
  • Rather than using a regex match on the addr:housenumber tag, I'm again simply checking that the tag exists, which is more efficient.
  • I've used a value of 5 meters for the around() filter. This will find all address nodes within 5 meters of... something. Truth is, I don't really understand how around() works with ways. It doesn't mean within 5 meters of the interior. If it did, 0 (or at least 1) would work. By trial-and-error, it doesn't seem to mean within 5 meters of the center, either. Nonetheless, if you're dealing with larger buildings, you may have to increase this number to catch the address nodes -- at the risk of false positives, if there are address nodes outside but near the buildings.

If there's a way to actually filter whats inside the perimeters of the buildings, rather than using around() to find what's nearby, I'd love to see that script.

permanent link

answered 08 Oct '18, 21:24

jmapb's gravatar image

accept rate: 17%

edited 08 Oct '18, 21:30

But with around I can't really check whether the node is inside or outside:

(08 Oct '18, 21:52) Norske

That's right -- it gives both false positives and false negatives. That's why I said it isn't really correct. I'd like to know the correct answer too, if there is one!

(09 Oct '18, 00:54) jmapb

This enhancement request may be relevant

(09 Oct '18, 08:26) andrewblack
Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 08 Oct '18, 16:40

question was seen: 279 times

last updated: 09 Oct '18, 08:26

powered by OSQA