BlenderGIS
BlenderGIS copied to clipboard
Multi-polygon buildings missing during OSM import
Blender and OS versions
Blender 2.92.0 running on Windows 10.
Describe the bug
Importing an OSM file which contains multi-polygon buildings will result in missing buildings.
How to Reproduce
Export an OSM file from the following map section: https://www.openstreetmap.org/#map=19/59.34306/18.04109
Import the OSM file into Blender. The result will be five buildings that miss geometry
This is a result of the buildings being defined with multiple polygons (i.e. Inner and Outer geometry).
Example:
<relation id="280199" visible="true" version="6" changeset="79504534" timestamp="2020-01-13T08:19:07Z" user="joihoin" uid="10431041">
<member type="way" ref="41962200" role="inner"/>
<member type="way" ref="41962199" role="outer"/>
<member type="way" ref="41962202" role="inner"/>
<member type="way" ref="41962201" role="inner"/>
<tag k="building" v="apartments"/>
<tag k="building:levels" v="7"/>
<tag k="roof:levels" v="1"/>
<tag k="type" v="multipolygon"/>
</relation>
My quick and dirty solution have been to write a simple script that processes the .osm
file. This process simply locates the outer
way node and append the building
tags to that way node. This allows me to import these buildings.
So for the above example my script locate the way
node 41962199
and append the building
, building:levels
, and roof:levels
tags to that way
-node:
<way id="41962199" visible="true" version="7" changeset="79505373" timestamp="2020-01-13T08:37:22Z" user="joihoin" uid="10431041">
<nd ref="520000411"/>
<nd ref="520000418"/>
<nd ref="7127875152"/>
<nd ref="7127875158"/>
<nd ref="7127875154"/>
<nd ref="520000416"/>
<nd ref="2838385937"/>
<nd ref="2838385935"/>
<nd ref="520000414"/>
<nd ref="520000411"/>
<tag k="building" v="yes"/> <!-- Line added by processing script -->
<tag k="building:levels" v="7"/> <!-- Line added by processing script -->
<tag k="roof:levels" v="1"/> <!-- Line added by processing script -->
</way>
However, this will only generate the outer geometry of the building, and any interior cut out shapes will be omitted.