I'm trying to plus two raster images through the python interface of QGIS, i want to use the saga raster calculator, but i got one error but i don't know why: i'm doing the following calculation (the extent of the input date is the same of the raster created by grass in this script

##output_rast=output raster

GAUSS_1=processing.runalg('grass7:r.surf.gauss', '0.0','15','219818.5071000000461936,245558.5071000000461936,6140993.5039999997243285 ,6177833.5039999997243285',30.0,None)
DEM_Gauss=processing.runalg('saga:rastercalculator', dem,[GAUSS_1],'a+b',False,7,output_rast)

but the code fails, anyone can see the error from this code?

1 Answer 1


Found the error

the object derivated from the raster calculator must have the prefix 'output_' and the raster calculator must have the string ['object'] so, the code will work with the following line:

output_DEM_Gauss=processing.runalg('saga:rastercalculator', dem,GAUSS_1['output'],'a+b',False,7,output_rast)

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.