0

How can I combine Landsat 8 and Sentinel 2 images, data fusion?

2 Answers 2

3

You first create an ImageCollection for Landsat and one for Sentinel 2, making sure they have the same band names and data types. Then you merge the two collections and create a mosaic the way you usually do it (median(), qualityMosaic(), etc).

var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .filter(filter)
  .map(function (image) {
    var qa = image.select('pixel_qa')
    image = image.select( // Same band names
      ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'],
      ['aerosol', 'blue', 'green', 'red', 'nir', 'swir1', 'swir2']
    )
    return image
      // You'd probably mask clouds here, using the qa band and/or cloud scoring
      .int16() // Same data type
  })

var s2 = ee.ImageCollection('COPERNICUS/S2_SR')
  .filter(filter)
  .map(function (image) {
    var qa = image.select('QA60')
    image = image.select( // Same band names
      ['B1', 'B2', 'B3', 'B4', 'B8', 'B11', 'B12'],
      ['aerosol', 'blue', 'green', 'red', 'nir', 'swir1', 'swir2']  
    )
    return image
      // You'd probably mask clouds here, using the qa band and/or cloud scoring
      .int16() // Same data type
  })
var fusion = l8.merge(s2)

var visParams = {bands: 'red,green,blue', min: 0, max: 3000}
Map.addLayer(l8.median(), visParams, 'L8')
Map.addLayer(s2.median(), visParams, 'S2')
Map.addLayer(fusion.median(), visParams, 'fusion')

https://code.earthengine.google.com/664d97f3a4a73885e4dcf05c7bd3beec

-2

This is not exactly what you wanted

/*
var collection = ee.ImageCollection('LANDSAT/LT04/C01/T1_SR')    // 7.1982-12.1993
var collection = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')    // 3.1984-1.2013
var collection = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR') // 4.1999-still on
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') // 2.2013-still on
*/
 var collection1 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR') //Changeable
    .filter(ee.Filter.eq('WRS_PATH', 174)) 
    .filter(ee.Filter.eq('WRS_ROW', 38));  
 var collection2 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') //Changeable
    .filter(ee.Filter.eq('WRS_PATH', 174)) 
    .filter(ee.Filter.eq('WRS_ROW', 38));  
var Collection=collection1.merge(collection2);   
var descending = Collection.sort('system:time_start', false);
print('Collection: ', descending);
var latest = ee.Image(descending.first());
Map.addLayer(latest,{bands:["B3","B2","B1"], min: 0, max: 3000}); //VIS 

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