I am writing a script in R for running in QGIS processing. The code is a oil spill classification algorithm and depending on the number of polygons which user inputs in the shapefile, output raster layers are to be produced, each containing the oil/water classification plot corresponding to each polygon in the shapefile. Since I do not know in advance how many polygons user is going to input, I cannot specify in the processing header like:
##out_plot_raster_1 = output raster
##out_plot_raster_2 = output raster
##out_plot_raster_3 = output raster
QGIS processing scripts support multiple raster input like:
## input_many_rasters = multiple raster
so it is logically inferred that same must be true for output also, but on trying:
## out_many_rasters = output multiple raster
I get an error and the script won't run at all.
Now, it is really important for me to be able to output multiple rasters at once so that user can get all the friendly options like "saving them to desired location" and "opening them in QGIS after the script run" which are automatically provided by the processing framework of QGIS. How do I do this? i.e. I want user to be able to enter, before the script run, the location to store all generated raster outputs and if he wants, the rasters must be opened in QGIS automatically after the execution is complete. Please suggest me a way to do this.