I have 2 rasters (raster1 and raster2) with 5 bands for each one. I want to do some calculation using all bands and write the output to a file with 5 bands.
I try this command :
gdal_calc.py -A raster1 -B ratser2 --outfile=result.tiff --calc="A+B"
but it generates a wrong output file with only 1 band.
Vince
20.5k16 gold badges49 silver badges65 bronze badges
-
Read gis.stackexchange.com/questions/203321/…. I believe that you must read A and B five times with different names so that you can do your five calc operations.user30184– user301842018年08月15日 15:01:37 +00:00Commented Aug 15, 2018 at 15:01
1 Answer 1
Maybe you can try:
gdal_calc.py -A raster1.tif --A_band=5 -B raster2.tif --B_band=5 --allBands=[A,B] --outfile=result.tif --calc="A+B"
Also check the following link.
answered Aug 14, 2018 at 22:41
-
1Hi Daniel, thank you for your replay but the option --allBands=[A,B] doesn't work. This option accept only one file.Sami– Sami2018年08月15日 13:58:57 +00:00Commented Aug 15, 2018 at 13:58
default