zoran-cuckovic / QGIS-visibility-analysis

Quantum GIS plugin for visibility analysis
GNU General Public License v3.0
73 stars 18 forks source link

ValueError: Null geometry cannot be converted to a point #49

Closed gisep closed 4 years ago

gisep commented 4 years ago

Hi, i'm trying to create viewpoints from a punctual shapefile in the projected CRS UTM zone 33N (EPSG 32633). It shows this error:

Versione di QGIS: 3.14.16-Pi Revisione codice QGIS: df27394552 Versione di Qt: 5.11.2 Versione di GDAL: 3.0.4 Versione di GEOS: 3.8.1-CAPI-1.13.3 Versione di PROJ: Rel. 6.3.2, May 1st, 2020 Algoritmo in esecuzione... In avvio l'algoritmo 'Create viewpoints' … Parametri in ingresso: { 'DEM' : 'C:/Users/GIZEH/Documents/GIS DataBase/PUGLIA/DTM/DTM PUGLIA.tif', 'OBSERVER_ID' : 'N.', 'OBSERVER_POINTS' : 'D:\Torri\Sistema di torri\GIS\New Viewshed\viewshedtorri.shp|layername=viewshedtorri', 'OBS_HEIGHT' : 1.6, 'OBS_HEIGHT_FIELD' : 'H [m]', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'RADIUS' : 5000, 'RADIUS_FIELD' : '', 'TARGET_HEIGHT' : 0, 'TARGET_HEIGHT_FIELD' : '' } Traceback (most recent call last): File "C:/Users/GIZEH/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\viewshed_points.py", line 226, in processAlgorithm field_radius= radius_field) File "C:/Users/GIZEH/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Points.py", line 146, in clean_parameters t = geom.asPoint() ValueError: Null geometry cannot be converted to a point. Esecuzione fallita dopo 0.03 secondi Caricamento layer Algoritmo 'Create viewpoints' terminato

If i try to change input layer for "Observer Locations" it runs well:

Versione di QGIS: 3.14.16-Pi Revisione codice QGIS: df27394552 Versione di Qt: 5.11.2 Versione di GDAL: 3.0.4 Versione di GEOS: 3.8.1-CAPI-1.13.3 Versione di PROJ: Rel. 6.3.2, May 1st, 2020 Algoritmo in esecuzione... In avvio l'algoritmo 'Create viewpoints' … Parametri in ingresso: { 'DEM' : 'C:/Users/GIZEH/Documents/GIS DataBase/PUGLIA/DTM/DTM PUGLIA.tif', 'OBSERVER_ID' : '', 'OBSERVER_POINTS' : 'D:/Torri/Sistema di torri/GIS/Idrogeomorfologia/537_bis idrogeomorfo/Rilievi/537_537b_vette.shp|layername=537_537b_vette', 'OBS_HEIGHT' : 1.6, 'OBS_HEIGHT_FIELD' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'RADIUS' : 5000, 'RADIUS_FIELD' : '', 'TARGET_HEIGHT' : 0, 'TARGET_HEIGHT_FIELD' : '' } Esecuzione completata in 0.01 secondi Risultati: {'OUTPUT': 'Output_layer_54548e5d_7a20_4be3_80f1_2b3cc3d0441d'} Caricamento layer Algoritmo 'Create viewpoints' terminato

Both layers are PointZ.

First layer (not running): immagine

Second (running example): immagine

I think that the problem is the incoherence of " / " and " \ " in the first code File "C:/Users/GIZEH/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Points.py", line 146, in clean_parameters but i don't know how to fix it.

I will be glad for every suggestion to resolve the problem.

gisep commented 4 years ago

I can't explain why but i solved it by saving the shapefile in a "geopackage".

zoran-cuckovic commented 4 years ago

Thank you for your input, I can't tell where does the error come from, apparently the points in the shapefile could not be read by the algo. I'm glad you could sort it out by converting your points file.