As an OpenStreetMap (OSM) user, but pretty newbie regarding to Blender (I know the basics, but never used in depth because I get lost) or developing, I would like to 3D print some buildings stored in OSM and maybe make some basic renderings/modifications with Blender. After having done some research I've come to two different workflows but unfortunately none of them work for me, so hopefully anyone can tell me how to improve them or provide another one:

Preamble: download OSM data

I have exported an OSM area into OSM's native format *.osm file (which is an xml file) from their website. Full explanations on exporting an OSM file can be found here. For purposes of this exercise I will be downloading this particular area, which looks like this on this 3D Viewer thanks to the work of the community.

enter image description here

The osm file that I am working with can be downloaded here as well.

Scenario 1: Using BlenderGis Addon

BlenderGis Addon provides a lot of interesting features for GIS users. Amongst others it can import osm files geolocate, terrain analysis... it seems great!

Unfortunately the osm importer only imports 2D information of the geometry, and no other osm information is stored (at least I haven't been able to find it).

I would still need to extrude each object and model their roofs, and I haven't found any fast way to do that. I have just created a feature request on their repo, but despite it seems quite active I do not know if it will be accepted.

Scenario 2: Using Blender Geo Addon

Due to those problems I tried Blender Geo Addon which can import buildings in 3D, judging by this awesome video. It seems it has everything I need, except for these annoying issues (for me):

  1. Only buildings that make use of osm's key building:height are extruded. Unfortunately this key is less used than building:levels which is more approximate but easier to get.
  2. All roofs are flat, something which is not always true in most areas. OSM has some keys in order to store information regarding roofs, such as their type (roof:type) orientation (roof:orientation) and so on. (more details on that on this wiki)
  3. There seem to be many overlapping meshes. (less cleaner than the other solution)

This is the result of the import:

enter image description here

The good news is that all this OSM information is stored as custom properties. The bad news is that I do not know how to work with them.

Regarding issue 1. I was wondering if there could be a way to extrude each object by its building:levels custom property without having to review and extrude them one by one.

Regarding issue 2: I do not have any idea on how to solve that. This is really a problem.

Regarding issue 3: I do not know if that's really a problem.

Final steps In case I could fix the import problem my idea is to use 3D print toolbox and export the model into stl file.

Can anyone provide any clues to overcome these problems?

  • $\begingroup$ Could certainly edit the importer to extrude buildings using same code that is used for height. It's just establishing what is the level height? Will post some pix with different values. $\endgroup$
    – batFINGER
    Commented Sep 8, 2016 at 12:50
  • $\begingroup$ Related: blendernation.com/2016/09/03/owen-powell-maps-terrain-models/… $\endgroup$
    – Samoth
    Commented Sep 13, 2016 at 16:28
  • $\begingroup$ @vvoovv Tags are for the question, not a potential answer. Secondly, a tag should only be created if there are a significant number of questions that could benefit from the tag. I don't know if that is true of this tag yet (it might be). $\endgroup$ Commented Mar 10, 2020 at 21:17
  • $\begingroup$ @RayMairlot, I thought the tag was applicable to the question, since the blender-osm addon was mentioned explicitly in the question. The addon was called blender-geo back in 2016. There are a number of questions about the blender-osm addon. I attempted to assign the tag blender-osm to them. $\endgroup$
    – vvoovv
    Commented Mar 12, 2020 at 5:50

2 Answers 2


Update 25 January 2017

The OpenStreetMap importer for Blender has been completely rewritten. Here is the link: https://github.com/vvoovv/blender-osm

A large number of roof shapes is supported: flat, gabled, hipped (for a quadrangle outline only), mono-pitched, half-hipped, round, pyramidal, gambrel, dome, onion and saltbox.

Below are some results of its work.

  • New York. The original OSM file contained more than 100.000 buildings and had the size 350 Mb.

enter image description here

  • Moscow Kremlin. The example showcases the support of flat, gabled, mono-pitched, dome, onion and pyramidal roof shapes.

enter image description here

  • $\begingroup$ Cool. re roofs have a look at gitlab.com/fg-radi/osm2city/blob/master/roofs.py $\endgroup$
    – batFINGER
    Commented Sep 18, 2016 at 14:03
  • $\begingroup$ Thank you for the link! I've already written some code to deal with hipped roofs through straight skeleton algorithm in another repo. There is a ticket to discuss roof support $\endgroup$
    – vvoovv
    Commented Sep 20, 2016 at 3:37
  • $\begingroup$ A large number of roof shapes is supported: flat, gabled, hipped (for a quadrangle outline only), mono-pitched, half-hipped, round, pyramidal, gambrel, dome, onion and saltbox. $\endgroup$
    – vvoovv
    Commented Jan 25, 2017 at 3:16

Here are some updates to the script https://github.com/vvoovv/blender-geo/blob/master/io_import_scene_osm.py

Extruded buildings based on building:levels using a level_height setting in import. Also added a scale setting.


Result So far.

enter image description here

Haven't done much with roofs yet.

Till I add it into code proper this adds some materials / object color to buildings

import bpy
from bpy import context

# CoDEmanX from BA.org
def hex_to_rgb(color_str):
    # supports '123456', '#123456' and '0x123456'
    (r,g,b), a = map(lambda component: component / 255, bytes.fromhex(color_str[-6:])), 1.0
    return (r,g,b,a)

scene = context.scene
# buildings with material

bm = [b for b in scene.objects if "building:colour" in b.keys()]
materials = {}
for b in bm:
    matname = b.get("building:material")
    if matname is None:
        matname = "building:material"
    mat = bpy.data.materials.get(matname)
    if mat is None:
        mat = bpy.data.materials.new(matname)
    mat.use_object_color = True
    if matname not in b.data.materials:
    if b.get("building:colour"):
        b.color = hex_to_rgb(b.get("building:colour"))

Might also pay to have a look at osm2x3d to convert to x3d and import from that format. (Haven't tried)

  • $\begingroup$ Wow! thank you! haven't been able to test it yet, since I'm away from my computer. Willing to do so! (once I've done that I will mark your answer). Thanks again. $\endgroup$
    – ccamara
    Commented Sep 10, 2016 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .