Blosm: Import of Google 3D Cities, OpenStreetMap, Terrain

I found a solution with 2.80 here Creating Heightmaps in Blender 2.8

this was my first reference https://www.youtube.com/watch?v=z_jh_PrZzOs&t=7s

I also found this, but I haven’t tried it yet …

however I think that with the initial image (if there was somewhere) it would be more comfortable and acurate

Hi @apo0o
The terrain data are stored in the folder /terrain.
However I am not sure if those terrain data can be used in other programs, since each file there is just a binary sequence of numbers.

Made with blender-osm addon: an amazing animation of PeniParker comic character by @oldspear:

Original tweet with thousands of likes and retweets: https://twitter.com/oldspear/status/1196078417268994049

Share your work made with blender-osm addon!

3 Likes

A great tutorial for blender-osm (premium) created by Nicko16:

2 Likes

Hi @vvoovv
after loading terain, OSM data is there a way to set 3D cursor (or vertex) location according to GPS location using OSM-blender georegerencing.
It would be useful when setting locations of ne buildings or project’s construction area and such.

Hi @Edmis
Please try the following:
After the import paste the following code snippet to the Blender’s Python Console and press Enter:

import math
def fromGeographic(lat, lon):
    radius = 6378137.
    k = 1.
    lat = math.radians(lat)
    lon = math.radians(lon-C.scene["lon"])
    B = math.sin(lon) * math.cos(lat)
    x = 0.5 * k * radius * math.log((1.+B)/(1.-B))
    y = k * radius * ( math.atan(math.tan(lat)/math.cos(lon)) - math.radians(C.scene["lat"]) )
    return x, y, 0.

Then executed the following line the Blender’s Python Console (use your own geographical latitude and longitude instead of lat and lon):

C.scene.cursor.location = fromGeographic(lat, lon)

For example:

C.scene.cursor.location = fromGeographic(55.75516, 37.61610)
1 Like

A review of the blender-osm addon by ArtisticRender.com:
https://artisticrender.com/blender-openstreetmap-importer-add-on-never-model-new-york-again/

1 Like

after trying, i get error:

Traceback (most recent call last):
File “<blender_console>”, line 1, in
File “<blender_console>”, line 4, in fromGeographic
NameError: name ‘math’ is not defined

Sorry, forgot the line import math, see the original reply

Please try it again.

1 Like

Awesome, thank you,
works like a charm :slight_smile:

Feature request:
Manually set the zoom level at which map tiles are downloaded. I’d like to get the best available resolution at a fairly large area to use as reference.

Hi @John_514
That’ a tricky feature.

Currently the resolution of the overlay imagery is calculated automatically by the addon, so the total size of the resulting texture does not exceed some threshold. Namely 256 image tiles (256x256 pixels), i.e. 4096x4096 pixels. Each image tile has dimensions 256x256 pixels.

Here are some possible problems for the option of the desired zoom if both area of interest and the zoom are big enough

  • Not enough memory for the resulting large image
  • Download of satellite imagery tiles is no more free
  • Heavy load on the services that provide completely free overlay imagery (e.g OpenStreetMap bitmap imagery)

So I refrain from providing that option.

However you could encrease the threshold for the maximum number of tiles on your own risk. Open Blender’s Python Console and paste:
C.scene.blender_osm.maxNumTiles = 256
Replace 256 with your own number and press Enter.

That option is available in the latest version (1.0.22) of the blender-osm (premium). Please download it via the link in your purchase confirmation e-mail.

1 Like

Ah, very reasonable. Thank you!

New user here, and I love the add-on.

I’ve incurred in a problem with textures, though, and I opened a ticket in Github https://github.com/vvoovv/blender-osm/issues/139

However, after reading more the instructions and reviews of Blender-osm, I’m confused as whether that’s an issue or a feature, specifically: can you create / add your own textures for the buildings once the objects are created with the basic version of the add-on, or that is a feature only for the premium version?
(I went for the basic version as I was not interested in the real building textures, but if that’s a requirement to have any kind of texturing, I would gladly buy the premium version instead)

Hi @marcolomeo
I replied to you in the Github ticket

Just noticed! Thanks for your support @vvoovv, it was a case of dumb user :slight_smile:
Problem solved! Blender-osm is fantastic!

Further question, is it possible to reduce the number of materials created by the import, while not loosing some of the color difference on buildings?
(a dozen materials would be fine, but the import creates hundreds, most of them almost identical)

Hi @marcolomeo
One solution would be to write a script that does the job.

I wouldn’t know where to start, as I’m no coder.
For one scene, I resorted to select all items and link assign them to one material only, discarding the rest, and then applying manually a dozen of materials and textures; but it’s not a smart way to do it.

Do you have any pointers about where to look at, for scripting what you describe? Thank you!

@marcolomeo
Here are the esssential code snippets for your task

# create a material with a desired diffuse color
import bpy
material = bpy.data.materials.new("MyMaterial")
# green color
material.diffuse_color = (0., 1., 0., 1.)
# access the diffuse color (Python list of 4 elements) of the material in the slot with index 0
# of the Blender object with the name MyObject
diffuse_color = bpy.data.objects["MyObject"].material_slots[0].material.diffuse_color
# replace the material in the slot with the index 0 of the Blender object
# with the name MyObject for the given Blender material
bpy.data.objects["MyObject"].material_slots[0].material = material