I'm porting my QGIS processing plugin algorithm from 2x - 3x.
The algorithm generates and outputs one to many rasters and adds them to the QGIS map canvas. The number of output rasters is unknown until the algorithm is executed.
In my QGIS 2x version, I set the output of the algorithm to be a
processing.core.outputs.OutputDirectory, save all the output rasters in that directory, then add them to the map using the
QgsMapLayerRegistry.instance().addMapLayer method. This is a bit of a kludge as it means the outputs can't automatically be used as inputs to other processing algorithms, but the 2x version was just a quick proof of concept demo.
Other than doing something similar to my 2x version (i.e. set a
QgsProcessingOutputFolder and add them to the map via
QgsProject.instance().addMapLayer), is there a recommended approach for QGIS 3x processing algorithm plugins to handle an unknown number of outputs? Perhaps something analogous to an
I would like to add the output rasters to the map when the alg is run manually from the toolbox (which I can), but this is not the primary aim of this question. It's more about having the multiple output rasters usable as inputs to other algorithms in a workflow.