I am trying to run QGIS processing tools in the OSGEO4W shell using the qgis_process functionality. I believe this functionality is fairly new as I have been having a hard time finding documentation for the syntax.

I am trying to run a raster calculator command using two tiffs as input, everything about the command runs fine except for the LAYERS parameter always returns an error as I am not sure how to list two layers in the parameter.

the command is:

qgis_process run qgis:rastercalculator --CELLSIZE=0 --CRS="ESPG:32610" --EXPRESSION=""octclip@1" + "marclip@1"" --EXTENT="D:/UPCD/clip1/octclip.tif" --LAYERS=D:/UPCD/clip1/octclip.tif D:/UPCD/clip1/marclip.tif --OUTPUT="D:/UPCD/clip1/try1.tif"

I have tried many things such as

--LAYERS=D:/UPCD/clip1/octclip.tif D:/UPCD/clip1/marclip.tif

--LAYERS="D:/UPCD/clip1/octclip.tif" "D:/UPCD/clip1/marclip.tif"



to no avail.

The documentation says it will allow paths both in quotes as well as without but I can not find anything regarding passing two paths to the parameter argument.

First time question poster, let me know if there is any information I am missing.

1 Answer 1


I have attempted to run saga:rasterstatisticsforpolygons with multiple inputs through the qgisprocess R package and have run into the same problem.

raster.A <- "D:/file_A.tif"
raster.B <- "D:/file_B.tif"
multilayer <- "VRT_AandB.vrt"
grids_attempt.1 <- paste(raster.A,raster.B,sep = ';')
grids_attempt.2 <- paste(raster.A,raster.B,sep = ',')
grids_attempt.3 <- paste(raster.A,raster.B,sep = ' ')
InputPolygons <-"D:/ZonesForZonalStats.gpkg"
result = "D:/ZonalStatsAdded.gpkg"

grids_attempt.x represents my three attempts to find a syntax that works. I additionally attempted to use a virtual raster as input (multilayer above). I did not attempt to use a multiband raster because SAGA does not accept multiband inputs.

GRIDS = grids_attempt.x,  
POLYGONS = InputPolygons,
MIN =0,
MAX =0,
SUM =0,
MEAN =1,
VAR =0,
RESULT = result,
.quiet = FALSE

I also attempted multiple syntax guesses in the OSGEO4W shell including a Python list.

    qgis_process-qgis run saga:rasterstatisticsforpolygons --GRIDS="['D:/file_A.tif','D:/file_B.tif']" --POLYGONS=D:/ZonesForZonalStats.gpkg --RESULT=D:/ZonalStatsAdded.gpkg --METHOD=1 --NAMING=0 --RANGE=1 --MEAN=1 --STDDEV=1

My current understanding is that multilayer input functionality is not available due to a bug in QGIS:

Ok -- this is a QGIS bug. There's no way to specify a list of layers from a string value alone. How to specify multilayer input? #25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.