[Addon] blender-osm: OpenStreetMap and terrain for Blender

(vvoovv) #1

Get the addon for just $5.90!

The addon provides one click download and import of OpenStreetMap and terrain with global coverage!

  • The addon imports buildings from OpenStreetMap. Building height and number of floors are used to create the final scene. Composition into 3D parts for a building with the complex structure is also processed. A large number of roof shapes is supported. If a terrain is provided, buildings are placed on the terrain automatically.
  • The addon downloads and imports real world terrain data with resolution about 30 meter
  • River, lakes, forests, vegetation are imported as polygons. If a terrain is provided, they are projected on the terrain.
  • Highways, paths and railways are imported as edges. If a terrain is provided, they are projected on the terrain.

Get the addon for just $5.90!

By buying the addon you support the addon development!

(SHABA1) #2

Seems like a much need and great add on. I will reserve judgment until I install it and see how this and the other addon you uploaded works. Just to let you know this has been tried before. About 3 years ago a user here tried to upload an addon that did the same thing. I somewhat got it to work but when I pointed out that he needed to answer questions about the operation he got upset and left the forum.

(JuhaW) #3

Well thank you and great job. Really works although face normals are irregular from building to building.

(vvoovv) #4

What do you mean? Can you show a screenshot?

(JuhaW) #5

Face normals.


(vvoovv) #6

I think I know the reason for that behavior. Points in some polygons in the OpenStreetMap are ordered clockwise, in the other polygons the points are ordered counterclockwise. As the consequence normals for the resulting Blender flat objects are pointing either upwards or downwards.

I’ll try to fix that.

(JuhaW) #7

Thats really not the problem, just select all and recalculate normals (Ctrl+N), you can do that in your script. Does OpenStreetMaps have height of the buildings ?

(vvoovv) #8

Some buildings do have height tag. Many buildings have number of storeys tag. There is even Simple 3D Buildings specification in OpenStreetMap which specifies how to tag some 3D attributes of a building. The Simple 3D Buildings specification page contains links to interactive demos where some cities can be explored with a 3D viewer.

I import all building tags as custom Blender object properties.

I consider OpenStreetMap import addon as auxiliary tool for further modelling. Personally I use imported flat building outlines to georeference a Blender scene with the OpenStreetMap Georeferencing addon. Also, the imported OpenStreetMap building outlines can be used to set correct scaling for a model with the Target Scaling addon.

So I don’t have plans to support tags from the Simple 3D Buildings specification

(vvoovv) #9

The short answer. I don’t see any convergence point. I think that’s quite normal. The author of the old OSM addon used different design principles.

Now the longer answer.

I import each OSM object as a separate Blender object with all OSM tags. I use OSM tags name or address to name the corresponding Blender object. This enables search by name or address in Blender. The old addon imports all OSM objects as a single Blender object.

I use the transverse Mercator projection with the central meridian coming through the center of the imported area. The projection choice is explained by the negligible size distortion in the vicinity of the central meridian. The old addon uses the UTM projection which divides the earth surface into 60 fixed zones. The size distortion could be quite noticeable near the UTM zone border.

Finally, I separated OSM parser from application logic. My OSM parser can used in any application, i.e. not only in Blender. As the consequence, my addon can be easily extended to add support for additional OSM tags.

(matali) #10

Just tried to see compatibility, it doesn’t work obviously. I’ll try to speak with domlysz.
A remark, all objects are with center at 0,0,0 and the actual vertices of the mesh are then many thousands kilometers away from origin. It may greatly reduce the precision. Would it be possible to center the first import on the origin to have full precision ? Blender is not as precise as Autocad. I couldn’t get any official numbers, but it’s most certainly a 32bit float. Precise near origin and loosing precision exponentially far away from it.

(vvoovv) #11

My primary use case is neighborhood (city, town) modelling. The area extent has order of magnitude of kilometers or dozens of kilometers.
OpenStretMap and SRTM terrain import doesn’t have sense on a large country or a continent scale.

Here is how my import addons calculate the location of the imported area in the Blender global coordinate system:

If the active scene does not have custom properties latitude and longitude or if Ignore existing georeferencing checkbox is checked, custom properties latitude and longitude are set for the active scene. They correspond to the center of the imported OSM area.

If the active scene does have custom properties latitude and longitude and Ignore existing georeferencing checkbox is unchecked, the custom properties latitude and longitude are used as the center for the import. In other words, the newly imported OSM objects will be placed correctly with respect to previously imported OSM objects.

(matali) #12

Maybe a bug then. In my case, on the default scene, when importing OSM with your addon (a part of Karlsruhe in Germany), the empty is on 0,0,0 but the plan of Karlsruhe is at 6Km on x and 6Km on y. Or I don’t understand the meaning of OSM center. I thought it was the center of the exported area. (I export the area viewed in browser from openstreetmap.org)

(SHABA1) #13

Am I missing something. I tried the addon on an .osm file of a small 4 block area in my city and all I got was and empty. No buildings or streets at all.

(vvoovv) #14

Could you send me your .osm files?

(matali) #15

As said in my post, your actual plan is somewhere else. You have to expand the empty in outliner to see the children, select one of them and in the 3D view hit . to center the view on your selection. In my case, my plan was 6Km away from empty.

@vvoovv Is this offset due to the precision limitation of the long/lat scene parameters ?

(vvoovv) #16

I didn’t see your .osm files, so here is my guess.
I think the reason for that behavior is that your .osm files contains long roads.
Roads aren’t imported but they are taken into account when the extent (bounding box) is calculated.

If the active Blender scene doesn’t have custom properties latitude and longitude, then the center of the imported OSM extent is used as the projection center. The projection center must be known before the first OSM object is added to the Blender active scene.

You can use JOSM OpenStreetMap editor to cut unnecessary stuff off and save the resulting .osm file to your local disk. But don’t send your edits back to the OSM global database!

(matali) #17

You guess was good, very long road indeed :smiley:
For the distances, their is no way to have OSM correctly scaled without manual tuning ?

Your addon is really good, thanks a lot for your help :slight_smile:

(SHABA1) #18

I just emailed you the .osm file. As far as these “custom properties” are concerned. Are these things we should set up in blender before we import the osm file. If so you need to document that well on the documentation pages you set up. As I read the pages they looked like items that were imported when you imported the .osm file.

(SHABA1) #19

OK next question. How does one do this?

(matali) #20

Custom properties are made by script on import. for JOSM, you can’t await from someone with a job, maybe family, giving you an addon fo free that he will learn you a program he didn’t do. Go on josm website and look the doc there.