0

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
});
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Feb 13, 2023 at 16:19

1 Answer 1

0

You are trying to export an imageCollection. Export.image.toDrive requires an image as input data, not an imageCollection.

Also, you have an image in your code (greenest), so use:

Export.image.toDrive({
image: greenest,
description: 'Chicago_2016EVI',
scale:10,
region: AOI
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.