TransWikia.com

Google Earth Engine Mosaic of Individual images

Geographic Information Systems Asked by Gab on September 26, 2020

I would like to make a mosaic of 3 specific Date and Time Landsat 8 images corresponding to thermal band 10, where overlapping pixels between images in the mosaic will get the mean value.
I could select the images from the collections and display them, but separately not as a mosaic-image with the overlapping pixels as average, my code is below.
I would like to also export to drive the mosaic obtained as GeoTiFF file.
How could all this process be done?
Thanks a lot.

// point of interest correspond to LANDSAT tiles
var point1  = ee.Geometry.Point(35.0062, 32.7828);
var point2  = ee.Geometry.Point(34.8863, 32.0921);
var point3  = ee.Geometry.Point(35.0425, 30.6345);

// display points of interest
Map.addLayer(point1, {color: 'FF0000'}, 'Point1')
Map.addLayer(point2, {color: 'FF0000'}, 'Point2')
Map.addLayer(point3, {color: 'FF0000'}, 'Point3')


// image collection filter for each image 
var dataset1 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
                  .filterDate('2017-07-01', '2017-08-01')
                  .filterBounds(point1);
                  
var dataset2 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
                  .filterDate('2017-07-01', '2017-08-01')
                  .filterBounds(point2);     
                  
var dataset3 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
                  .filterDate('2017-07-01', '2017-08-01')
                  .filterBounds(point3);
                  
// explore image collection
print(dataset1)
print(dataset2)
print(dataset3)

// find images id 
//dataset1 id  = LANDSAT/LC08/C01/T1/LC08_174037_20170731
//dataset2 id  = LANDSAT/LC08/C01/T1/LC08_174038_20170731
//dataset3 id  = LANDSAT/LC08/C01/T1/LC08_174039_20170731

               
// image of interest as variables     
var dataset1 = ee.Image("LANDSAT/LC08/C01/T1/LC08_174037_20170731");
var dataset2 = ee.Image("LANDSAT/LC08/C01/T1/LC08_174038_20170731");
var dataset3 = ee.Image("LANDSAT/LC08/C01/T1/LC08_174039_20170731");


// select thermal bands 

// thermal bands detaset 1
var thermalBand10_1 = dataset1.select(['B10']);
var thermalBand11_1 = dataset1.select(['B11']);

// thermal bands detaset 2
var thermalBand10_2 = dataset2.select(['B10']);
var thermalBand11_2 = dataset2.select(['B11']);

// thermal bands detaset 3
var thermalBand10_3 = dataset3.select(['B10']);
var thermalBand11_2 = dataset3.select(['B11']);


// display thermal  bands
Map.addLayer(thermalBand10_1,{min:0,max:65535},'thermalBand10_1');
Map.addLayer(thermalBand10_2,{min:0,max:65535},'thermalBand10_2');
Map.addLayer(thermalBand10_3,{min:0,max:65535},'thermalBand10_3');

One Answer

To combine the three images:

var threeImages = ee.FeatureCollection([
  thermalBand10_1,
  thermalBand10_2,
  thermalBand10_3,
]);
var meanImage = threeImages.mean();

That said, your script can be greatly simplified by working with a collection from the start, so that you do not have to repeat any code three times. For example:

var images = ee.ImageCollection([
  ee.Image("LANDSAT/LC08/C01/T1/LC08_174037_20170731"),
  ee.Image("LANDSAT/LC08/C01/T1/LC08_174038_20170731"),
  ee.Image("LANDSAT/LC08/C01/T1/LC08_174039_20170731"),
]);

var thermalBand10 = images.map(function (image) {
  return image.select('B10');
});

Map.addLayer(thermalBand10.mean());

Correct answer by Kevin Reid on September 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP