cityjson / cityjson-qgis-plugin

A QGIS plugin that adds support for CityJSON files
Apache License 2.0
35 stars 8 forks source link

AttributeError: 'QgsPolygon3DSymbol' #57

Open StefanCiesilski opened 7 months ago

StefanCiesilski commented 7 months ago

Hello @liberostelios , I get an error message when loading CityJSON:

Ein Fehler trat bei der Ausführung von Python-Code auf:

AttributeError: 'QgsPolygon3DSymbol' object has no attribute 'setMaterial' Traceback (most recent call last): File "C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CityJSON-loader\cityjson_loader.py", line 299, in run self.load_cityjson(filepath) File "C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CityJSON-loader\cityjson_loader.py", line 321, in load_cityjson skipped_geometries = loader.load() File "C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CityJSON-loader\core\loading.py", line 129, in load self.styler.apply(vl) File "C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CityJSON-loader\core\styling.py", line 39, in apply symbol.setMaterial(material) AttributeError: 'QgsPolygon3DSymbol' object has no attribute 'setMaterial'

Python-Version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS-Version: 3.32.2-Lima Lima, c0b8833964

Python-Pfad: C:/osgeo4w/apps/qgis/./python C:/Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/osgeo4w/apps/qgis/./python/plugins C:\osgeo4w\apps\grass\grass83\etc\python C:\WINDOWS\system32 C:\osgeo4w\bin\python39.zip C:\osgeo4w\apps\Python39\DLLs C:\osgeo4w\apps\Python39\lib C:\osgeo4w\bin C:\osgeo4w\apps\Python39 C:\osgeo4w\apps\Python39\lib\site-packages C:\osgeo4w\apps\Python39\lib\site-packages\win32 C:\osgeo4w\apps\Python39\lib\site-packages\win32\lib C:\osgeo4w\apps\Python39\lib\site-packages\Pythonwin C:/Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\rvt-qgis C:/Users/ciesilski/AppData/Roaming/QGIS/QGIS3/profiles/default/project_templates

LoD2_32_608_5584_2_TH.zip

Is it because of the QGIS version?

Thanks Stefan

chenkianwee commented 7 months ago

I also had the same issue. I solved it by going to the file 'C:\Users/ciesilski/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\CityJSON-loader\core\styling.py' line 39. Change the line from "symbol.setMaterial(material)" to "symbol.setMaterialSettings(material)". the plugin shld work after that

tmuguet commented 7 months ago

Same issue starting from QGIS 3.30. The workaround works well, though I needed to also patch it at lines 67 and 79