[GIS] Image collection and mosaic handling in google earth engine

google-earth-engine

I would like to know how to handle ee.Imagecollection output for mosaic.
I am trying to use AOI shapefile to identify the Landsat TM 5 imagery.

var start= ee.Date('1987-01-01');
var end  = ee.Date('1988-01-01'); 
var collection= ee.ImageCollection('LANDSAT/LT5')
    .filterBounds(fc)//fc is shapefile variable 
    // .filterBounds(city)
    .filterDate(start, end)
    .aside(print)
    .sort('CLOUD_COVER',false); 
 print ('ImageCollection', collection);

which results in

ImageCollection LANDSAT/LT5 (6 elements)
type: ImageCollection
id: LANDSAT/LT5
version: 1502218468957000
bands: []
features: List (6 elements)
properties: Object (17 properties)

then I use following function to mosaic it.

var customComposite = ee.Algorithms.Landsat.simpleComposite({
    collection: collection,
    percentile: 10,
    cloudScoreRange: 5
});

The output is single mosaic image, but how I can know which images were used for mosaic and How I can run mosaic on the all 6 elements?

Best Answer

First of all I think you misunderstand the concepts, simpleComposite makes a composite and not only a mosaic, for mosaicing you have mosaic. So,

How I can run mosaic on the all 6 elements?

in your code you are making a composite of all 6 images

how I can know which images were used for mosaic?

The only way you have is to create a band in every image that makes some reference to the image itself. But you are bounded to the data types. For example, you couldn't create a band for image ids (str). But you could think in a workaround. It depends on your data.

You have at least 2 more options for making a composite, if you have a quality band you can use ImageCollection.qualityMosaic() (in my opinion this function mistakes the concepts too) and if you are doing a more complex operation you also have arrays, could be something like:

var col = ee.ImageCollection(ID)
var arr = col.toArray()
var qb = arr.arraySlice(1, 1, 2)
var sorted = arr.arraySort(qb)

And so on.

Related Question