4

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
asked Aug 14, 2018 at 22:07
1
  • 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. Commented Aug 15, 2018 at 15:01

1 Answer 1

3

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
1
  • 1
    Hi Daniel, thank you for your replay but the option --allBands=[A,B] doesn't work. This option accept only one file. Commented Aug 15, 2018 at 13:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.