When I run a GDAL processing algorithm from the Python Console in QGIS that loads a result raster:
resultClip = processing.runAndLoadResults("gdal:cliprasterbymasklayer", {
'ALPHA_BAND' : False,
'CROP_TO_CUTLINE' : True,
'DATA_TYPE' : 0,
'EXTRA' : '',
'INPUT' : 'E:/geodata/nsw100k.vrt',
'KEEP_RESOLUTION' : False,
'MASK' : 'C:/Users/brennant/Downloads/data.geojson',
'MULTITHREADING' : False,
'NODATA' : None, 'OPTIONS' : '',
'OUTPUT' : 'TEMPORARY_OUTPUT',
'SET_RESOLUTION' : False,
'SOURCE_CRS' : None,
'TARGET_CRS' : None,
'X_RESOLUTION' : None,
'Y_RESOLUTION' : None })
I can access the temporary raster output file via
resultClip['OUTPUT']
However, when I do the same thing with one of the Whitebox Tools algorithms (eg BreachDepressions):
resultBreach = processing.runAndLoadResults("wbt:BreachDepressions", { 'dem' : resultClip['OUTPUT'], 'max_depth' : '20.0', 'flat_increment' : 0.00001, 'fill_pits' : 1, 'output' : 'TEMPORARY_OUTPUT' })
resultBreach['output']
returns a QgsProcessingOutputLayerDefinition
variable:
<QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {}}>}
The temporary layer is created and loaded in the layers window, but from a PyQGIS processing point of view, I can't see how to access it for use in future steps.
And if I look at both algorithms using processing.algorithmHelp eg
processing.algorithmHelp("gdal:cliprasterbymasklayer")
the output type for both is the same (QgsProcessingOutputRasterLayer)
Suggestions welcomed.