How can I sum up two bands of different images using Google Earth Engine.

I uploaded two images to the GEE, but I would like to know how to do the sum between them: image1 + image2 = image3.

I try, but fail

var image3 = ee.ImageCollection('image1', 'image2').merge(sum)

1 Answer 1


You don't merge them into a collection. Also have a look at the documentation, I know it can be overwhelming but it's more than helpful.

var image3 = image1.add(image2)
  • Hello @JonasV. I tested your code, but I discovered another problem. Image1 has pixels with a "nodata" value. This nodata was not included, why is it? Commented Dec 19, 2020 at 12:35
  • Because nodata + x = nodata. If you want to include it, you have to convert nodata to a value first
    – JonasV
    Commented Dec 20, 2020 at 11:59
  • hello @JonasV, really convert the nodata to a value. I managed to solve my problem here. add () is very efficient. Commented Dec 20, 2020 at 21:17

Your Answer

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

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