I am trying to export a geotiff from GEE and it keeps on giving me this error message:
Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. Expected type: Image<unknown bands>. Actual type: ImageCollection. (Error code: 3)
Here is my code:
var AOI = ee.FeatureCollection(AOI);
function maskS2clouds(image) {
var qa = image.select('QA60');
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;
var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
.and(qa.bitwiseAnd(cirrusBitMask).eq(0));
return image.updateMask(mask).divide(10000);
}
var filtered = s2.filterDate('2016-01-01', '2016-12-31') // << change date range here
.filterBounds(AOI)
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',10))
.map(maskS2clouds)
.map(function(image){return image.clip(AOI)});
var addEVI = function(image) {
var EVI = image.expression(
'2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', {
// 'NIR' : image.select('B8').divide(10000),
// 'RED' : image.select('B4').divide(10000),
// 'BLUE': image.select('B2').divide(10000)}).rename('EVI');
'NIR' : image.select('B8'),
'RED' : image.select('B4'),
'BLUE': image.select('B2')})
.rename('EVI');
return image.addBands(EVI);
};
var with_evi = filtered.map(addEVI);
var greenest = with_evi.qualityMosaic('EVI');
Map.addLayer(with_evi, {min:0, max:0.5, bands:'EVI', palette: 'brown, lightgreen'}, 'EVI');
Export.image.toDrive({
image: with_evi.select('EVI'),
description: 'Chicago_2016EVI',
scale:10,
region: AOI
});