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.
https://gist.github.com/batFINGER/87ad90900be589281eeeaa83697d541f
Result So far.
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:
b.data.materials.append(mat)
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)