1

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?

3
  • "The size of cost raster is: 0 * 0" looks like the key problem, there is probably something wrong with your input
    – Ian Turton
    Oct 15, 2019 at 12:09
  • Is this a saga tool 'Least cost paths'?
    – vinh
    Oct 15, 2019 at 13:51
  • No - The author is "FlowMap [email protected]" - a Plugin
    – IanGS
    Oct 15, 2019 at 14:39

1 Answer 1

1

All of your problems seem to be related to the size of your input raster. Either you are trying to process an enormous area or you are using a very detailed DEM (or both) - it is probably worth reducing either the area of interest or the detail of the DEM.

The maximum size is probably related to available memory on your machine, it's operating system (windows/linux? 32/64 bit?) - you may find that using the GRASS procedures mentioned in your linked question are more robust (but that is purely prejudice on my part).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.