In my standalone PyQGIS script I would like to merge two raster layer. "zero" and "raster". Both variables are definitly QgsRasterLayer
objects. This is the function:
def merge(self):
zero = self.setToZero()
raster = self.getRasterLayer()
outDir = os.path.join(QgsProject().instance().homePath(), "Verschmelzung.tiff")
param = {"input": [zero, raster],
"output": outDir}
merge = processing.run('gdal:merge', param)
rlayer = QgsRasterLayer(merge['output'], 'mergedRaster')
return rlayer
An that is the error message:
_core.QgsProcessingException: Unable to execute algorithm Incorrect parameter value for INPUT Traceback (most recent call last): File "C:/Users/Jan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gebeude_betroffenheit\Gebeude_Betroffenheit.py", line 347, in run
self.zonalStatistics() File "C:/Users/Jan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gebeude_betroffenheit\Gebeude_Betroffenheit.py", line 315, in zonalStatistics
raster = self.focalStatistics() File "C:/Users/Jan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gebeude_betroffenheit\Gebeude_Betroffenheit.py", line 297, in focalStatistics
raster = self.merge() File "C:/Users/Jan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\gebeude_betroffenheit\Gebeude_Betroffenheit.py", line 292, in merge
merge = processing.run('gdal:merge', param) File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\tools\general.py", line 105, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context) File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins\processing\core\Processing.py", line 139, in runAlgorithm
raise QgsProcessingException(msg)
_core.QgsProcessingException:
Unable to execute algorithm Incorrect parameter value for INPUT
According to this link it wants a list of rasters, and that is what I'm giving no.
I don't see the problem…
I'm using QGIS 3.4