I'm trying to create a QGIS script that would use multiple Raster layers as an input parameter. But QgsProcessingParameterRasterLayer only gives a single Raster as input and QgsProcessingParameterMultipleLayers defaults to a multiselect of Vector layers.

I'm probably missing something easy, but how can I get the multiselect to work with raster files like the Merge Rasters tool does for example?

1 Answer 1


Just pass the QgsProcessing.SourceType to the QgsProcessingParameterMultipleLayers class constructor:

def initAlgorithm(self, config=None):
        self.tr("Input rasters"),

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.