domlysz / blendergis Goto Github PK
View Code? Open in Web Editor NEWBlender addons to make the bridge between Blender and geographic data
License: GNU General Public License v3.0
Blender addons to make the bridge between Blender and geographic data
License: GNU General Public License v3.0
Hi Dominique,
I saw your great Wiki and the installation for gdal python bindings inside blender ont this page : https://github.com/domlysz/BlenderGIS/wiki/How-to-install-GDAL
It's very helpfull but there is windows only installation. I don't use Windows. According to you, I would want to add other plateform to your wiki.
Mac Osx
Tested on Yosemite 10.10 and Blender 2.74
1) Install Xcode and Macports from this link :
https://www.macports.org/install.php
2) Install gdal and gdal python bindings
Open a terminal from spotlight or from Applications => Utilities => Terminal
Then type with administratives rights :
sudo port install gdal py34-gdal
3) Copy osgeo folder from python bindings to blender
cp -rf /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/osgeo /where_you_put_blender_on_your_mac/Blender/blender.app/Contents/Resources/2.74/scripts/modules/
Replace where_you_put_blender_on_your_mac with the path where you run or install Blender
Test it in Blender Python console like windows installation.
I think there is a mistake in the wiki with this :
Finally, to get GDAL working in Blender, just copy osgeo folder in Python tree folder of Blender (C:\Program Files\Blender Foundation\Blender\2.70\python\lib\site-packages).
If I put the osgeo folder in the same path like you recommand (python/lib/site-packages), I'm not able to launch gdal from blender. When I put osgeo in blender's module folder, It works !
Sorry for my poor english, I'm french ...
Sincerely,
Sylvain
Hi I have blender 2.77a installed on Ubuntu 16.04 along with your great add on. Unfortunately I have not been able to successfully use it on linux (although I have tried on Windows 7 and it worked fine). What Im getting when importing a SHP file is after checking the box next to either "Elevation from field", or "Extrusion from field", no dropdown appears with field options.
Thanks!
I have just imported an osm file and works great (love the filter per key type). However I thought buildings would be in 3D but they are "only" flat elements.
According to this OSM's wiki on 3D buildings, OSM offers some tags that are used to store information about buildings that could be used to generate 3D meshes instead of flat ones.
Amongst others, I find these ones could be interesting to be imported:
building:levels
(as there are many more buildings that have this information instead of this one building:height
roof:shape
(which can be flat, skillion, gabled, half-hipped, hipped, pyramidal, gambrel, mansard, dome, onion,round, saltbox )roof:orientation
=along/acrossroof:direction=*
Additionally, these ones could be considered too:
roof:height
roof:angle
Hi Domlysz,
When I import one of the files included in http://download.geofabrik.de/europe/germany/baden-wuerttemberg/freiburg-regbez-latest.shp.zip , although I added the epsg code you gave in the dxf thread in user prefs and I used it on import, it is too small (the whole region is smaller than the default cube). When I import the SHP after importing the DXF it works like a charm.
The console output:
Read shapefile...
Feature type : PolyLine
0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%
Imported mesh had some problem, check the result!
PyContext 'window' not found
PyContext 'window' not found
PyContext 'scene' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'gpencil_data' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'edit_object' not found
PyContext 'screen' not found
PyContext 'screen' not found
PyContext 'window' not found
Hi Domlysz,
It would be better if the export code could let the scene as it is.
Regards
This quirk isn't a big deal, but it caught me out, so I thought I'd raise it as an issue...
After importing a Shapefile, if you rotate the mesh and apply the transformation before using the Delaunay triangulation utility, the TIN will have errors in it. For example:
TIN created by rotating Shapefile mesh without applying the rotation:
TIN created by rotating Shapefile mesh and applying the rotation:
Hello, sorry if my question sounds easy, but I'm new in this.
I am trying to use BlenderGIS to georefence a 3D model in Blender. I managed to install the addon, but i can't find any CRS in Geoscene preferences. I want to use Lambert-93 (EPSG:2154 with transformation : 1671, according to epsg.io). I tryed to type these different codes in the Query, but keyword searh doesn't seem to work ...
What can I do ?
Thank you
Love this plugin! I'm wondering if it can import shapefiles that are scaled by size to a certain attribute? Right now all i can get is a set of vertices that i cannot seem to convert into objects (see image). Also see question here.
"Please define a valid cache folder path ... " when I try to use this. Serveral path I did enter but the message appears ever.
Fill the mesh with delaunay triangulation or another build in function (it's just a regular grid...)
Hi, i'm new in this.
When i try install complements in blender i can't, and appear a message saying Traceback (Most recent call last):
File"/" applications/blender.app/contents/MacOs/2.71/scripts/addons/basemaps/init.py",line 45,in <module form.mapviewer import*>
and other similar messages, i don`t know, any help me please?.
Operate System: Os X 10.10
Blender 2.7
Thanks!
Currently shp importer is terribly slow with large or even intermediate dataset especially with extrusion and separate object options.
Test file submitted by BenRacicot :
pvd-shp.zip
Currently the code extensively use list comprehension with all dataset in memory. Using iterator/generator can help to not overloading memory.
http://gis.stackexchange.com/questions/148834/creating-a-really-large-shapefile-without-eating-all-the-virtual-memory
https://github.com/mlaloux/PyShp-as-Fiona--with-geo_interface-
However it doesn't seems to be the real limitation here, Python can handle very large dataset with decent performance while Blender's 3d view can really be slow down with too many object or large mesh.
Profiling the code show that separate objects performance drop down is caused by implicit scene updates calls through repetitive operators executions inside place obj function
more infos and possible workaround : http://blender.stackexchange.com/questions/7358/python-performance-with-blender-operators.
In our case we need to find an alternative to bpy.ops for setting objects origin to geometry
For extrusion, bmesh.ops.extrude_face_region is the most cumbersome operation, it seems more tricky to find a workaround here
I highly doubt this is a bug, but I hope somebody can give me guidance. When I attempt to import a 16-bit raster DEM in tif format, I get very unusual results. See graphic at this link:
http://www.sco.wisc.edu/images/stories/download/blender2.png
However, the DEM looks as expected in QGIS:
http://www.sco.wisc.edu/images/stories/download/qgis.png
The process I used in Blender after installing BlenderGIS: file... import... georeferenced raster... Mode as DEM. Did not apply on an existing mesh.
Any thoughts on where I am going wrong? The process to import a DEM seems very straightforward.
Hi, thanks for your great tool.
I was unable to use the 3D viewer with my default ubuntu packaged blender (v 2.62, for ubuntu 12.04 LTS) because you import bmesh, which is included from 2.63. My advice is:
a) in the readme (or wiki) add a compatibility issue and tell to use v>=2.63
or
b) fix it ;) (painfully?)
cheers
Add possibility for use OpenOrienteering Mapper files, that are XML-based (with support many custom tags for each map object) and open format for orienteering maps.
When zooming in the viewport after aligning the 3D datas and the basemaps, the alignment is lost. It looks like the basemap is being zoomed to mouse position, but not the 3D view, which is zoomed toward 0,0,0. (even when zoom to mouse position is activated in the Blender's user prefs)
Zooming when the mouse is over 0,0,0 works great.
https://github.com/vvoovv/blender-geo
It use transverse Mercator projection (not UTM) with dynamically calculated central meridian to minimize distortions. The central meridian comes through the center of the imported area.
https://github.com/vvoovv/blender-geo/wiki/Georeferenced-Blender-Scene
proj4 string equivalent:
+a=6378137 +b=6378137 +proj=tmerc +lat_0=0 +lon_0=6 +k_0=1 +x_0=0 +y_0=0 +units=m
with lon_0 = central meridian (here 6°)
To get this compatibility reprojection capability is needed with consequences :
When Blender starts, their is a warning regarding geoscene:
Warning: addon-module 'geoscene' found module but without addon_enabled field, possible name collision from file: 'C:\Users\test\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\geoscene*init*.py'
module changed on disk: C:\Users\test\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\geoscene__init__.py reloading...
I would suggest to move images to the wiki repo:
[email protected]:domlysz/BlenderGIS.wiki.git
Each wiki forms a separate git repo. One can work with it like with a usual git repo.
To clone the wiki just execute:
git clone [email protected]:domlysz/BlenderGIS.wiki.git
Then move images to the wiki repo, commit and push them back
When calling the BlenderGIS addon from my own script, I'm getting a segmentation fault when importing a Shapefile for the second time (it works fine the first time).
Here's a minimal example:
import bpy
from os.path import abspath, dirname
from bpy import context
bpy.ops.importgis.shapefile("INVOKE_DEFAULT", filepath = abspath(dirname(__file__))+"/shapefile.shp", shpCRS="EPSG:27700", fieldElevName="ELEV", separateObjects = False) # Works fine
bpy.ops.importgis.shapefile("INVOKE_DEFAULT", filepath = abspath(dirname(__file__))+"/shapefile.shp", shpCRS="EPSG:27700", fieldElevName="ELEV", separateObjects = False) # Causes Blender to crash
I'm using Blender 2.78 on Mac OS 10.12.1. Here's the terminal output:
Jamies-MBP:Documents jamie$ /Applications/blender.app/Contents/MacOS/blender -b -noaudio -P Minimal.py
Read new prefs: /Users/jamie/Library/Application Support/Blender/2.78/config/userpref.blend
found bundled python: /Applications/blender.app/Contents/MacOS/../Resources/2.78/python
Exception in module register(): '/Users/jamie/Library/Application Support/Blender/2.78/scripts/addons/BlenderGIS-master/__init__.py'
Traceback (most recent call last):
File "/Applications/blender.app/Contents/MacOS/../Resources/2.78/scripts/modules/addon_utils.py", line 349, in enable
mod.register()
File "/Users/jamie/Library/Application Support/Blender/2.78/scripts/addons/BlenderGIS-master/__init__.py", line 131, in register
km = wm.keyconfigs.active.keymaps['3D View']
AttributeError: 'NoneType' object has no attribute 'keymaps'
Read shapefile...
Feature type : PolyLine
0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%
Build in 0.404313 seconds
Read shapefile...
Feature type : PolyLine
0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%
Build in 1.482001 seconds
Writing: /var/folders/c2/wz9svkyd1qv1lpnzbcpvbxlr0000gn/T/blender.crash.txt
Segmentation fault: 11
blender.crash.txt is attached, along with a zip of the Shapefile (I get the same error with various Shapefiles).
see discussion @ #21
Hi,
Map viewer fails to download background images under windows 10 and 2.78a
Have to setup :
https://wiki.blender.org/index.php/User:Cnd/Extensions:2.6/Py/Scripts/Import-Export/DXF_Importer
it use pyproj to convert coords on the fly
SRID info is stored in scene
Hi,
I've some files with objects allready georeferenced, and would like to be able to append them to current scene.
In such scenario, linked objects are imported with current scene origin offset added.
It could be usefull to offset selection from current scene georeference.
Maybe 2 small buttons (add and remove offset) could do the trick.
Hi Domlysz,
At the moment, the Delaunay triangulation sometime gives plateaus were there shouldn't be one. It is due to the fact that verts of the same height are taken as candidates, even if edges are already present. Here is a blend showing the problem and what "bridge edge loops" does. Would it be possible to have an option 'ignore verts of the same height' or better, ignore them automatically when verts are in an edge?
I'am trying to import shapefiles from this source: http://www.geoportalpraha.cz/cs/opendata/6F72EDDF-CAA4-4243-8776-7006CB0B2521#.WH3WFWeqSM8 and it simply does not work. It ends with error "Unable to read shapefile".
Also, I must run import from File > Import, when I press space and choose Import SHP, it end with error, probably it needs to have already some file selected.
I'm processing a shapefile that has missing values for the variable I'm using to extrude shapes. The values were generated by the QGIS zonal statistics plugin which produces a value of all asterisks, in this case, e.g.:
Id : 0D4F7142E65527B3E050A00A568A259B
Featcode : 15014
mean : ************************
The version of pyshp bundled here doesn't handle this properly. The latest version at (https://github.com/GeospatialPython/pyshp) returns a value of None in this case.
But this still causes BlenderGIS to error. It would be better to handle these explicitly in your code, e.g. by setting the value to 0 for if the field value is None.
The bundled version of the shapefile library is also two years old so this should be updated too.
Hi,
Thanks for developing this add-on, it helped me a lot.
The issue is I think related that the export code of QGIS (and maybe other programs) specifies the world coordinates for the center of the corner pixels, not the corners of the image. It is particularly visible when importing images that should tile perfectly (and do tile perfectly when importing in QGIS), when importing them in Blender there is a small gap between each tile image.
Just talk about BlenderGIS !
Hi Domlysz,
First of all, your addon is really impressive and useful!
I tried to get the basemap align with the 3D DTM from maperitive. But somehow, there is a light scale difference. The 3D model from maperitive aligns perfectly with .osm datas downloaded from the overpass API of openstreetmap.
What I've tried so far to solve the problem:
Hi Domlysz,
"path to long for windows, overpass request failed" is printed in the console output.
Regards
Greetings,
I'm having some trouble installing BlenderGIS in Blender v2.69. The "Set reference cam" and "Import raster georeferenced with world file" add-ons appear and install just fine (see picture), but the other three add-ons in the BlenderGIS package (io_shapefile, terrain_analysis, and delaunay_voronoi) do not.
I looked at the "init.py" for the "io_shapefile" add-on, and nothing in the "# Register in File > Import menu" section looked drastically different from the same section in the working "io_import_georaster.py" script, so I can't identify the problem that prevents Blender from adding io_shapefile to the add-ons list.
The only thing I noticed that all the non-working add-ons have in common is that they are in folders with multiple scripts, whereas the working add-ons are standalone scripts.
Any insight would be most appreciated!
When I try to import shp file from this archive:
BD3_Bero00_polygonZ.zip
script crashes with following error:
Traceback (most recent call last):
File "/home/disnel/.config/blender/2.77/scripts/addons/io_shapefile/op_import_shp.py", line 300, in execute
for i, feat in enumerate(shpIter):
File "/home/disnel/.config/blender/2.77/scripts/addons/io_shapefile/shapefile.py", line 437, in iterShapes
yield self.__shape()
File "/home/disnel/.config/blender/2.77/scripts/addons/io_shapefile/shapefile.py", line 357, in __shape
(mmin, mmax) = unpack("<2d", f.read(16))
struct.error: unpack requires a bytes object of length 16
location: <unknown location>:-1
location: <unknown location>:-1
When I try to comment out lines 356 - 364, file is imported fine, but it probably breaks something else.
Also, I experienced Blender crashes on files imported from SHP, here is related bugreport:
https://developer.blender.org/T48239
Don't know, if it is related to SHP importer or not. These crashes occurs with or without commented lines in script, however.
UPDATE: Importer produces inccorect mesh for this (and similar) file. Instructed by Campbell Barton from BF I added mesh validation into script as temporary fix. Will make pull request for it. This does not solve original problem, however.
UPDATE 2: According to SHP spec on wiki (https://en.wikipedia.org/wiki/Shapefile#Shapefile_shape_format_.28.shp.29), M range values are optional but import script is expecting them in all cases. Will try to fix it.
I must say that this plugin is one of the best I've ever seen. What huge potential here, thank you for working so hard on it.
I have quite a few attributes in my shapefile (.dbf?) such as building names. Is there anyway to map them to each 3d item as well? If not perhaps this can be another enhancement opportunity to map attributes with to each Blender item created. Thanks again.
With latest buildbot and Gdal installed as you say in the docs (really good quality doc, I hope more plugins devs would document their addon like you). But I get following error and crash: http://www.pasteall.org/69995
I took gdal 2.0.2 and had to update numpy to 1.10.4, just like in your doc also. Note that the crash also happened before updating Numpy, so it's not due to Numpy I guess.
The tests from gdal import ...
all work correctly in the python console without error.
Hi,
Currently working to implement io for gps based path to setup (dji phantom like) drones fly path (kml, kmz) right in blender.
Got a rougth implementation reading kmz (path only) from earth and kml export still needing some love (especially altitude as relative ones instead of absolutes - we do have to make some more tests).
The export has proven to be a pretty good basis to setup fly, and tracked movie resulting path show a realy small derivation in xy coords of 0.3m only (with a constant 3m +- 0.5 on z axis mostly due to setup error). So it's working like a charm.
I have an odd problem. I create a new blender project with a GeoTIFF DEM added as plane and then again as DEM. I add a geo-referenced camera and have everything setup to render a lovely hill-shaded image. If I render the image after saving project and without closing the project I get the expected output. If I save the project, close it and then re-open it I get a flat grey image without any of the relief. All the settings are saved as set.
Any suggestions as to what might be happening here? I have 91 tiles to render and would like to batch process them by setting up the .blend files and letting them run overnight instead of having to manually run each one.
This happens on both Windows 7 64bit and Linux Mint 18 64bit with the Blender GIS extension added. Other Blender projects created without using the extension reopen correctly. I have attached the Blender file that create the first image above: 8_3.zip
And the GeoTIFF: int_tiff.zip
Bonjour Dominique,
J'ai une question sur les exports, je souhaiterais exporter en dxf, ce qui est possible dans Blender d'origine (qui produit d'ailleurs un résultat très propre d'un DEM en TIN) mais je perds mon géoréférencement. Du coup, ma question porte sur "comment ça fonctionne" pour réexporter en conservant le géoréfrencement.
Si je me réfère à ça
if "Georef X" in scn and "Georef Y" in scn:
dx, dy = scn["Georef X"], scn["Georef Y"]
else:
dx, dy = (0, 0)
Le dx et dy correspond au centre de l'objet importé ou centre de la scene ? Je pense que c'est l'objet et du coup je pourrais exporter en DXF géoréférencé en déplaçant mon objet avant de l'exporter grâce à bpy.data.scenes['Scene']['Georef X'] et bpy.data.scenes['Scene']['Georef Y'] que j'ai pu récupéré dans la console python
Du coup un simple déplacement devrait suffir pour que ce soit efficace avec :
bpy.ops.transform.translate(value=dx, dy, 0)
J'ai testé dans la console python puis export et ouverture dans Draftsight, ça fonctionne. Il faut que je scripte tout ça maintenant. Serais-tu intéressé pour l'intégrer dans le projet BlenderGIS ?
Cdt,
Sylvain
Hello
i can install the addon without any problems but when i try to enable it blender complain about numpy, i copy the traceback bellow
its only ocuur in blender 2.77
in blender 2.74 it work like a charm
tnaks Claudio
Traceback (most recent call last):
File "/usr/share/blender/2.77/scripts/modules/addon_utils.py", line 330, in enable
mod = import(module_name)
File "/home/claudio/.config/blender/2.77/scripts/addons/BlenderGIS-master/init.py", line 43, in
from .basemaps import mapviewer
File "/home/claudio/.config/blender/2.77/scripts/addons/BlenderGIS-master/basemaps/mapviewer.py", line 36, in
from .mapservice import MapService, PILLOW
File "/home/claudio/.config/blender/2.77/scripts/addons/BlenderGIS-master/basemaps/mapservice.py", line 41, in
import numpy as np
File "/usr/lib/python3/dist-packages/numpy/init.py", line 153, in
from . import add_newdocs
File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/usr/lib/python3/dist-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/usr/lib/python3/dist-packages/numpy/core/init.py", line 6, in
from . import multiarray
ImportError: cannot import name 'multiarray'
Hi,
The nasa with it's SRTM data is I think the best source of elevation data that is freely accessible. Would it be possible to download the right SRTM data for the zone we work on and use the greyscale data in the displace modifier?
Make first consistent release tagged 1.0
doc
add gdal_data path info
ui
update enum index after adding a new crs
geoscene
ensure scale support
geo append functionnality
prefs
vector import (shp & osm) >> remove double option
reproj
epsg.io limit to 100 features or 1000 points
builtin reproj table 3857>4326 & 4326>UTM >> 3857>UTM
basemaps
add option for setting storage days
background image layer manager >> reorder, view on/off, opacity
when panning, update all existing bkg images location (send a list as parameter)
split getimage() to have a dedicated seedCache(bbox) function
georaster
reproj via uv mapping or gdal
read crs from geotags
shp import
attribute data support at import and export
read proj from *.prj using http://prj2epsg.org/apidocs.html service
select & import multiple files
check geom
progress bar
test recent pyshp speed up PR
shp export
performance tests
OSM import
extrude or flat option
get height from MNS
interpret roof shape
fix separate objects origin
terrain analysis
svg ramp parse error (see BA thread)
georef cam
cam z position parameter
exif cam
lib Tyf
read crs from geotags (see georaster)
harmonize jpeg and tiff, implement iter, dumps to dict
Utils tools
drop to ground
display geocoords for selected vertex in edit mode
SRTM online downloader
http://www.opentopography.org/developers
http://elevation.bopen.eu/en/stable/quickstart.html
LIDAR
best lib ?
pure python laspy (must be updated to py3)
libLAS python binding
pylidar, lot of py deps and rely on lastools
PDAL ?
extrude building footprint with height value from lidar data
Hi,
When i do open the user prefs dialog to setup a CRS, i get the following error :
Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.77\scripts\startup\bl_ui\space_userpref.py", line 1437, in draw
draw(context)
File "C:\Users\stephen\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\BlenderGIS-master\prefs.py", line 96, in draw
elif pyproj:
NameError: name 'pyproj' is not defined
Seem to be a lower case error in pyproj. replace by PYPROJ fix this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.