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.addParameter(QgsProcessingParameterMultipleLayers(
self.INPUT,
self.tr("Input rasters"),
QgsProcessing.TypeRaster))