I am doing classification with Landsat 8 and other information to predict farm land use. I want to use monthly data(Monthly composite) rather than data from 2015-01-01' to '2016-12-22'. I think I should use ImageCollection.toArray() but i am not sure how to use it.
function maskL8sr(image) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = (1 << 3);
var cloudsBitMask = (1 << 5);
var snowBitMask = (1 << 4);
var waterBitMask = (1 << 2);
// Get the pixel QA band.
var qa = image.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(snowBitMask).eq(0);
return image.updateMask(mask);
}
var image = ee.Image(ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2015-01-01', '2016-12-22')
.filter(ee.Filter.lte('CLOUD_COVER',20)) // filter on Cloud Cover
.map(maskL8sr)
.sort('CLOUD_COVER')
.filterBounds(geometry)
.median())
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'],min:0, max: 3000}, 'ture colour image');