How do I save GDAL processing output rasters to a temporary layer? Using 'memory:'
for vector processes works fine, but I couldn't get it to work for GDAL processes.
output_rast = self.parameterAsOutputLayer(parameters,self.OUTPUTR,context)
if True:
magnitude_rast = processing.run("gdal:rasterize", {
'INPUT':buffer_extent,
'BURN': magnitude,
'UNITS': 1,
'WIDTH': 1.0,
'HEIGHT': 1.0,
'EXTENT': buffer_extent,
'OUTPUT': 'memory:'
}, context=context, feedback=feedback)['OUTPUT']
if True:
source_rast = processing.run("gdal:rasterize", {
'INPUT':parameters['SOURCE'],
'BURN': 100,
'UNITS': 1,
'WIDTH': 1.0,
'HEIGHT': 1.0,
'EXTENT': buffer_extent,
'OUTPUT': 'memory:'
}, context=context, feedback=feedback)['OUTPUT']
if True:
proximity_rast = processing.run("gdal:proximity", {
'INPUT':source_rast,
'BAND': 1,
'VALUES': 100,
'UNITS': 0,
'DATA_TYPE': 5,
'OUTPUT': output_rast
}, context=context, feedback=feedback)['OUTPUT']
return {self.OUTPUTR: output_rast}
I've also tried using None
for the output parameter as recommended here but I get an incorrect parameter value error.