2

I have created two image collections (monthly average) from different datasets, one is LST (MODIS MOD11A2 ) and the another one is NDVI (MODIS MOD13Q1). The two datasets have exactly the same date.

How to merge them together into one image collection, which each image has two bands (LST and NDVI) ?

4

You should show more effort and paste some code, what you have tried. But anyhow, I think this is what you want:

// Collections
var mod1 = ee.ImageCollection("MODIS/006/MOD11A2");
var mod2 = ee.ImageCollection("MODIS/006/MOD13Q1");

// Some dates to filter
var d1 = ee.Date.fromYMD(2017,1,1)
var d2 = ee.Date.fromYMD(2017,3,1)

// filter collections and select needed bands
mod1 = mod1.filterDate(d1, d2).select('QC_Day')
mod2 = mod2.filterDate(d1, d2).select('NDVI')

// Use an equals filter to define how the collections match.
var filter = ee.Filter.equals({
  leftField: 'system:index',
  rightField: 'system:index'
});

// Create the join.
var simpleJoin = ee.Join.simple();

// Applt join
var mod1join = ee.ImageCollection(simpleJoin.apply(mod1, mod2, filter))
var mod2join = ee.ImageCollection(simpleJoin.apply(mod2, mod1, filter))

print('Joined', mod1join, mod2join)

var final_col = mod1join.map(function(img){

  // Create a collection with 1 image
  var temp = ee.ImageCollection(ee.List([img]));

  // Apply join to collection 2
  // Resulting collection will have 1 image with exact same date as img
  var join = simpleJoin.apply(mod2join, temp, filter);

  // Get resulting image
  var i2 = ee.Image(join.first())

  return img.addBands(i2)
})

print(final_col)

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.