I want to combine 3 overlapping rasters to create 1 raster. Each have the same dimensions, resolution and CRS. I want to populate the new raster with the maximum value from each of the layers. However, when I use gdal_calc.py the output only writes two of the rasters.

Any ideas?

gdal_calc.py -A ./EXTENT_30_OS_clipped_nodata.tif -B ./EXTENT_100_OS_clipped_nodata.tif -C ./EXTENT_1000_OS_clipped_nodata.tif --calc="maximum(A,B,C)" --outfile=./EXTENT_1000_100_30_OS.tif --type=Byte --NoDataValue=-9999 --overwrite
  • this is not exactly the answer, but you could use otbcli_BandMath -il im1.tif im2.tif im3.tif -out max.tif -exp "max(im1b1, im2b1,imb1)" from the OTB library (orfeo-toolbox.org/otb)
    – radouxju
    Jul 15, 2014 at 16:05

1 Answer 1


gdal_calc.py as stated in documentation:


uses numpy array functions, in this case numpy.maximum, which is specified here:


It says you can use only 2 parameters. So your calculation expression for three grids must look like this:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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