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

Hi everyone!

I'm now using OSMnx to extract data for buildings. What I need is the addresses for buildings along with their footprint data. The question I met is about some of the buildings have multiple addresses, thus there are no address data for that building's polygon.

For example, the building 'Furutorpsgatan 49A' (in Helsingborg, Sweden) has three nodes you can search for, which are:

Furutorpsgatan 49A; Furutorpsgatan 49B; Gustav Adolfs Gata 23

alt text

but if you export the geometry data (polygon), there's no address data at all!

I was trying to use OSMid for polygons to match the position, but I can't find the building with OSMid 'w483244917'

Then I'm thinking is there any method I can export the polygon data through one or several nodes inside?

Or could you suggest me some methods to get any building footprint polygons through building addresses?

Thank you!

asked 14 Apr '22, 18:02

Adam%20Qi's gravatar image

Adam Qi
11113
accept rate: 0%

edited 14 Apr '22, 21:50

1

I don't know about OSMnx, but in the particular example you give those addresses are on entrance nodes that form part of the building way so on the OSM side of things there is a direct relationship recorded between the address nodes and the outline. This way has the ID you mentioned in your question: https://www.openstreetmap.org/way/483244917 , so I'm not sure why it doesn't show through your preferred tool? While w/n/r are frequently used as a shorthand for the element type in question I don't think they form a formal part of the ID in the database.

In general it is acceptable for addresses to exist on nodes as well as ways and relations and for completeness you will have to look at all three. In some cases you will be able to 'recurse up' to find ways that refer to nodes you find, in others this would need to be a spatial query for surrounding building ways or multipolygon relations and in some further cases there may be nodes for which no building outline has been traced yet.

(15 Apr '22, 10:26) InsertUser

Import data into PostGIS with osm2pgsql, then

SELECT way
FROM planet_osm_polygon
WHERE ST_CONTAINS(way, 
   (SELECT way FROM planet_osm_point 
   WHERE osm_id=1234))
AND building IS NOT NULL;

will find you the building outline that contains the node with the id 1234. Of course you could also query for the node properties with something like WHERE tags->'addr:street'='something' and so on. (This syntax with tags assumes you have imported with the "hstore" option.)

permanent link

answered 15 Apr '22, 10:43

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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:

×132
×92
×75
×5

question asked: 14 Apr '22, 18:02

question was seen: 2,348 times

last updated: 15 Apr '22, 10:43

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