1

I did some calculations on variety of image collections and have generated products and saved them in variables, say a, b and c. Now I want to combine all these products (All one bands) into a multiband image collection.

What function should i use? I tried with:

a.combine(b).combine(c)
a.merge(b).merge(c)
a.add(b).add(c)

But, these functions are not working.

3

Assuming you made a unique name for each band, and that you want to obtain one image with 3 bands (one for a, one for b and one for c) you have to addBands, like this:

var a = ee.Image(1).rename('one') // product one
var b = ee.Image(2).rename('two')
var c = ee.Image(3).rename('three')

var final = a.addBands([b, c])

link: https://code.earthengine.google.com/5c3ceef589fc8cbe6036f8f2ef22f2ca

  • I tried with this one already. It works on single images, but not on image collections. – Ramla Apr 23 at 7:04
  • The combine function works for three bands, but combining more then 3 prompts the error of empty ImageCollection – Ramla Apr 23 at 8:27
  • You should show your code and error message, at least a link to the code editor – Rodrigo E. Principe Apr 23 at 10:21
  • This is why you must post all the code (or a code that can reproduce the error) when you make the question.. combine function is what you need, but you are trying to combine collections that have images with different IDs, and if you see combine documentation it says that combines by ID, so when applying a join it doesn't find a match. If you want to join by date, you have to make the process yourself (join first and then add bands) – Rodrigo E. Principe Apr 23 at 11:42

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.