0

Does anyone know how can I stack all this collection?

I made my own collection from January Landsat images (L7 and L5) and I would like to stack all the images to check which are the areas with more data (without clouds).

var col = imageCollection
  .sort('system:time_start')
  .filterBounds(region)
  .map(function(image) {
    var date = ee.Date(image.get('system:time_start'));
    var savi = image.expression(
      '(1 + L) * float(nir - red)/ (nir + red + L)',
      {
        'nir': image.select('B4'),
        'red': image.select('B3'),
        'L': 0.5
      });
      var mask = image.select(['cfmask']).neq((1,2,3,4));
    return ee.Image(1).addBands(savi).updateMask(mask);
  });
2
  • what do you mean by stack? do you want to see (visualize) all images in the collection? Nov 22, 2017 at 23:37
  • An ImageCollection is effectively a stack of images in the spatial as well as temporal dimensions. What is your goal?
    – Kersten
    Nov 23, 2017 at 8:10

1 Answer 1

1

I gather that you want to combine multiple image collections into a single one. To do that, you first have to make sure both collections have exactly the same bands. Then you simply call merge()

var l5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
  .select( // Select and rename bands to a normalized set of bands/band names
    ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'pixel_qa'],
    ['blue', 'green', 'red', 'nir', 'swir1', 'thermal', 'swir2', 'pixel_qa']
  )
var l7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR')
  .select( // Select and rename bands to a normalized set of bands/band names
    ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'pixel_qa'],
    ['blue', 'green', 'red', 'nir', 'swir1', 'thermal', 'swir2', 'pixel_qa']
  )
var imageCollection = l5.merge(l7)

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.