zoran-cuckovic / QGIS-visibility-analysis

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

Crash running Viewshed #44

Closed mrpaulday closed 4 years ago

mrpaulday commented 4 years ago

Running Viewshed overnight, crashed in the morning Large 5m DEM (OS Terrain 5), 75 targets, calculating cumulative viewshed to 100km

Report Details Crash ID: https://github.com/qgis/QGIS/search?q=6bdc15eef93fa06fad98a53b9bfd465135722e1f&type=Issues Stack Trace

QObject::thread : QgsProcessingAlgorithm::runPrepared'::1'::catch$46 qgsprocessingalgorithm.cpp:519 _CallSettingFrame handlers.asm:50 __FrameHandler3::CxxCallCatchBlock frame.cpp:1499 RcConsolidateFrames : QgsProcessingAlgorithm::runPrepared qgsprocessingalgorithm.cpp:502 QgsProcessingAlgRunnerTask::run qgsprocessingalgrunnertask.cpp:66 sipQgsProcessingAlgRunnerTask::run sip_corepart1.cpp:91980 QgsTask::start qgstaskmanager.cpp:78 QThreadPoolPrivate::reset : QThread::start : BaseThreadInitThunk : RtlUserThreadStart : QGIS Info QGIS Version: 3.10.7-A Coru�a QGIS code revision: 7b4ca4c Compiled against Qt: 5.11.2 Running against Qt: 5.11.2 Compiled against GDAL: 3.0.4 Running against GDAL: 3.0.4

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.18363

mrpaulday commented 4 years ago

Tried running the Viewshed (to 100km) again on the same 5m DEM, but this time with only one of the 75 points selected.

The DEM is a 740 MB, 32-bit FLOAT geoTIFF with 5m resolution.

Viewshed Log QGIS version: 3.10.7-A Coruña QGIS code revision: 7b4ca4c8d0 Qt version: 5.11.2 GDAL version: 3.0.4 GEOS version: 3.8.1-CAPI-1.13.3 PROJ version: Rel. 6.3.2, May 1st, 2020 Processing algorithm… Algorithm 'Viewshed' starting… Input parameters: { 'ANALYSIS_TYPE' : 0, 'DEM' : 'H:/DEM/OST5_Mosaic_ZeroHtSea.tif', 'OBSERVER_POINTS' : QgsProcessingFeatureSourceDefinition('Pts_x75_Height_187_043a2626_67dc_4702_91bf_dbf6f04374d7', True), 'OPERATOR' : 0, 'OUTPUT' : 'H:/ZTVs/Pts_x1_Height_187pt5m_to_100km.tif', 'REFRACTION' : 0.13, 'USE_CURVATURE' : True }

Traceback (most recent call last): File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\visibility.py", line 112, in error_matrix err_old = min_err[yx][0] KeyError: (36026, 37913)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\viewshed_raster.py", line 243, in processAlgorithm refraction = refraction ) File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Raster.py", line 155, in set_master_window self.error_matrices = ws.error_matrix( radius_pix, size_factor) File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\visibility.py", line 115, in error_matrix min_err[yx]=[err,j,i] MemoryError

Execution failed after 28321.02 seconds

Loading resulting layers Algorithm 'Viewshed' finished

QGIS Processing Log - Time indicated is possibly at point of exception occuring 2020-07-22T19:55:32 CRITICAL Traceback (most recent call last): File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\visibility.py", line 112, in error_matrix err_old = min_err[yx][0] KeyError: (36026, 37913)

         During handling of the above exception, another exception occurred:

         Traceback (most recent call last):
          File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\viewshed_raster.py", line 243, in processAlgorithm
          refraction = refraction )
          File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Raster.py", line 155, in set_master_window
          self.error_matrices = ws.error_matrix( radius_pix, size_factor)
          File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\visibility.py", line 115, in error_matrix
          min_err[yx]=[err,j,i]
         MemoryError

QGIS Python Warnings - Time indicated is at start of running process 2020-07-22T12:03:31 WARNING warning:C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Points.py:419: DeprecationWarning: QgsSpatialIndex.insertFeature() is deprecated s_index.insertFeature(f)

         traceback: File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\viewshed_raster.py", line 206, in processAlgorithm
          points.take(dem.extent, dem.pix)
          File "C:/Users/Paul/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\Points.py", line 419, in take
          s_index.insertFeature(f)
zoran-cuckovic commented 4 years ago

Hello, the report states that you have a memory error. There are too many pixels in a single viewshed for your computer to handle. You should down-sample your DEM to 25 metres, or larger. Note that there are very few cases when you would need high precision data for 100 km distances (installing a telescope ?). Even if that were the case, DEM errors, geodesy, atmospheric refraction, etc. would still pose problems...

mrpaulday commented 4 years ago

Thanks Zoran, I thought it might be something like that.
I have run the Viewshed successfully and quickly with 50m data, which is good for a regional view of visibility impact from a proposed large turbine array. I still need more detail in specific areas and will try reducing the extent of the 5m DEM and the range of analysis to see if that will work; if not, I can try down-sampling to a lower resolution. Cheers, Paul