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 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 Qi |
Import data into PostGIS with osm2pgsql, then
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 answered 15 Apr '22, 10:43 Frederik Ramm ♦ |
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.