[GIS] Filter least cloudy image per each tile in GEE

google-earth-enginesentinel-2

Is there a “quick" way in Google Earth Engine to show in an image collection (Sentinel 2) the least cloudy image per each path/row or tile (multiple tiles) for a given timeframe? So far I managed to filter but not to pick the selection of the best images.

Best Answer

Not sure if this is exactly what you want, but you can sort() and mosaic():

var s2 = ee.ImageCollection('COPERNICUS/S2');

var composite = s2.filterDate('2016-01-01', '2016-12-31')
                  .sort('CLOUDY_PIXEL_PERCENTAGE', false)
                  .map(function(image) {
                    return image.addBands(image.metadata('system:time_start'));
                  })
                  .mosaic();

Since there's a time band, you'll be able to recover the date of each pixel.

Related Question