domlysz / BlenderGIS

Blender addons to make the bridge between Blender and geographic data
GNU General Public License v3.0
7.78k stars 1.35k forks source link

After installing GDAL, using the web basemap tool crashes Blender #702

Open pl4sma2389 opened 2 years ago

pl4sma2389 commented 2 years ago

Blender and OS versions

Blender 3.2.2, Windows 11, GDAL-3.4.3-cp310-cp310-win_amd64, numpy-1.22.4+mkl-cp310-cp310-win_amd64

Describe the bug

I have used BlenderGIS for a long time now, but to solve a reprojection issue with a project I had to install GDAL. Now, after I have installed GDAL, adding a web basemap using any settings crashes Blender. I think I installed GDAL correctly, as none of the tests returned anything unexpected. I did set the GDAL_DATA env variable to G:\Alt Program Files\Blender Foundation\Blender 3.2\3.2\python\lib\site-packages\osgeo\data\gdal. I tried out various combinations of projection and image processing engines, and they all crash. I also don't know how to "uninstall" GDAL, so I can't get any basemaps at all right now.

How to Reproduce

Install Blender 3.2.2 Install BlenderGIS Use the web basemap tool, observe that it works as expected. Install GDAL into Blender following the instructions on the wiki and using the .whl files named above. Attempt to use the web basemap tool, and observe Blender crash.

Error message

# Blender 3.2.2, Commit date: 2022-08-02 18:15, Hash bcfdb14560e7
bpy.ops.object.delete(use_global=False, confirm=False)  # Operator
Deleted 1 object(s)  # Info
bpy.ops.view3d.map_start(dialog="MAP")  # Operator
Python: Traceback (most recent call last):
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\operators\view3d_mapviewer.py", line 523, in execute
    bpy.ops.view3d.map_viewer('INVOKE_DEFAULT', srckey=self.src, laykey=self.lay, grdkey=self.grd, recenter=self.recenter)
  File "G:\Alt Program Files\Blender Foundation\Blender 3.2\3.2\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\operators\view3d_mapviewer.py", line 602, in invoke
    self.map = BaseMap(context, self.srckey, self.laykey, self.grdkey)
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\operators\view3d_mapviewer.py", line 85, in __init__
    self.srv = MapService(srckey, cacheFolder)
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\basemaps\mapservice.py", line 386, in __init__
    self.srcTms = TileMatrix(GRIDS[self.srcGridKey])
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\basemaps\mapservice.py", line 87, in __init__
    self.xmin, self.ymax = self.geoToProj(lonMin, latMax)
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\basemaps\mapservice.py", line 143, in geoToProj
    return reprojPt(4326, self.CRS, long, lat)
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\proj\reproj.py", line 337, in reprojPt
    rprj = Reproj(crs1, crs2)
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\proj\reproj.py", line 231, in __init__
    self.crs1 = crs1.getOgrSpatialRef()
  File "C:\Users\ohyea\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\BlenderGIS-228\core\proj\srs.py", line 158, in getOgrSpatialRef
    raise ValueError('Cannot initialize osr : ' + self.proj4)
ValueError: Cannot initialize osr : +init=epsg:4326
Location: G:\Alt Program Files\Blender Foundation\Blender 3.2\3.2\scripts\modules\bpy\ops.py:113  # Error

# backtrace
Exception Record:

ExceptionCode         : EXCEPTION_ACCESS_VIOLATION
Exception Address     : 0x00007FF77B3C0EB6
Exception Module      : blender.exe
Exception Flags       : 0x00000000
Exception Parameters  : 0x2
    Parameters[0] : 0x0000000000000000
    Parameters[1] : 0xFFFFFFFFFFFFFFFF
waruthp commented 2 years ago

I agree with you and I have faced the same problems.

AbdelghaniTamort commented 3 months ago

bump facing the same issue @domlysz

MLWeber commented 1 month ago

Had the same problem with Blender 4.2.2, BlenderGis 2.2.10 and GDAL-3.9.2-cp311-cp311-win_amd64. Replacing GDAL with an older version (GDAL-3.6.4-cp311-cp311-win_amd64) fixed it for me.