Sunday 3 June 2018

qgis 3 - Error with Least Cost Path plugin


I receive the following error when attempting to find a least cost pathway in a very large dem file (42GB). is this because the file is simply too large? If so, does anyone know the constraints for such a file?


QGIS version: 3.8.3-Zanzibar

QGIS code revision: 685d8b15d2
Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.8.0-CAPI-1.13.1
PROJ version: Rel. 5.2.0, September 15th, 2018
Processing algorithm…
Algorithm 'Least Cost Path' starting…
Input parameters:
{ 'BOOLEAN_OUTPUT_LINEAR_REFERENCE' : True, 'INPUT_COST_RASTER' : 'E:/BU Volunteer/QGIS/Ians-Rift-Valley/10-overlayed-maps/least-cost-stuff/east-africa-zerod.tif', 'INPUT_END_LAYER' : 'E:/BU Volunteer/QGIS/Ians-Rift-Valley/10-overlayed-maps/least-cost-stuff/omo-end-4326.gpkg|layername=omo-end-4326', 'INPUT_RASTER_BAND' : 1, 'INPUT_START_LAYER' : 'E:/BU Volunteer/QGIS/Ians-Rift-Valley/10-overlayed-maps/least-cost-stuff/awash-start-4326.gpkg|layername=awash-start-4326', 'OUTPUT' : 'TEMPORARY_OUTPUT' }


The size of cost raster is: 0 * 0
Searching least cost path...
Traceback (most recent call last):
File "C:/Users/Bing/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath\least_cost_path_algorithm.py", line 236, in processAlgorithm
min_cost_path, costs, selected_end = dijkstra(start_row_col, end_row_cols, matrix, feedback)
File "C:/Users/Bing/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath\dijkstra_algorithm.py", line 84, in dijkstra
grid = Grid(block)
File "C:/Users/Bing/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath\dijkstra_algorithm.py", line 45, in __init__
self.w = len(matrix[0])
IndexError: list index out of range


Execution failed after 0.14 seconds

Loading resulting layers
Algorithm 'Least Cost Path' finished

The


IndexError: list index out of range

suggests this??





I've reduced the dimensions of the DEM considerably, though the process did crash again - though this time a memory error??


The size of cost raster is: 10368 * 9015
Searching least cost path...
Traceback (most recent call last):
File "C:/Users/Bing/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath\least_cost_path_algorithm.py", line 236, in processAlgorithm
min_cost_path, costs, selected_end = dijkstra(start_row_col, end_row_cols, matrix, feedback)
File "C:/Users/Bing/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\leastcostpath\dijkstra_algorithm.py", line 125, in dijkstra
cost_so_far[nex] = new_cost
MemoryError


Execution failed after 1518.02 seconds

Loading resulting layers
Algorithm 'Least Cost Path' finished



We did finally get the plugin to complete when the DEM was redused still further.


QGIS version: 3.8.3-Zanzibar
QGIS code revision: 685d8b15d2

Qt version: 5.11.2
GDAL version: 2.4.1
GEOS version: 3.8.0-CAPI-1.13.1
PROJ version: Rel. 5.2.0, September 15th, 2018
Processing algorithm…
Algorithm 'Least Cost Path' starting…
Input parameters:
{ 'BOOLEAN_OUTPUT_LINEAR_REFERENCE' : False, 'INPUT_COST_RASTER' : 'E:/BU Volunteer/QGIS/Ians-Rift-Valley/10-overlayed-maps/least-cost-stuff/adama.tif', 'INPUT_END_LAYER' : 'E:\\BU Volunteer\\QGIS\\Ians-Rift-Valley\\10-overlayed-maps\\least-cost-stuff\\adama.gpkg|layername=adama', 'INPUT_RASTER_BAND' : 1, 'INPUT_START_LAYER' : 'E:/BU Volunteer/QGIS/Ians-Rift-Valley/10-overlayed-maps/least-cost-stuff/awash-start-4326.gpkg|layername=awash-start-4326', 'OUTPUT' : 'TEMPORARY_OUTPUT' }

The size of cost raster is: 8765 * 7727

Searching least cost path...
Search completed! Saving path...
Execution completed in 4058.56 seconds
Results:
{'OUTPUT': 'Output_least_cost_path_a74cf0f6_b4aa_4ee6_a876_ef6c26f4e164'}

Loading resulting layers
Algorithm 'Least Cost Path' finished

The over-riding questions are therefore, what are the limitations on DEM dimensions and are there any ways of reducing the resolutions of the DEMs in order to make them workable?





When I run the Least Cost Path plugin in QGIS, its success is dependant upon the dimensions of the 'cost raster'. If the original DEM or subsequent 'cost raster' it too large then the operation seems to fail. I've also found that the results from this plugin are at variance to the results from the more lengthy/complicated process such as these suggested here. Finding Least Cost Path in QGIS?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...