4

I need to convert my ee.Image which has 20 bands, to an ee.ImageCollection, where the information in each band is now stored in a single-band image. I've used the .toBands() function in the past: I am essentially looking for the reverse.

For example, in one ee.Image, My bands are named as follows:

"Arborimus_albipes"
"Chaetodipus_hispidus"
"Euderma_maculatum"
"Lasiurus_seminolus"
"Myotis_ciliolabrum"
"Neotoma_fuscipes"
"Nycticeius_humeralis" ....

How would I go about this?

1 Answer 1

4

Map over the list of bands to produce images, then cast.

var bands = image.bandNames()
var list = bands.map(function(n) { return image.select([n]) })
var collection = ee.ImageCollection.fromImages(list)
1
  • that worked. Perfect, thanks so much Noel!
    – BeEsKnees
    Commented Jan 31, 2023 at 16:13

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.