1

When I try to export I am facing the error stating:

"Unknown element type provided: string. Expected: ee.Image, ee.ImageCollection, ee.FeatureCollection, ee.Element or ee.ComputedObject."

var s2 = ee.ImageCollection("COPERNICUS/S2");
var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
  .filter(ee.Filter.date('2016-01-01', '2016-12-31'))
  .filter(ee.Filter.bounds(studyArea))
var image = filtered.median().clip(studyArea); 
Map.centerObject(studyArea, 10)
var ndvi = image.normalizedDifference(['B8', 'B4']).rename(['ndvi']);
Map.addLayer(ndvi);
var mndwi = image.normalizedDifference(['B3', 'B11']).rename(['mndwi']);
Map.addLayer(mndwi);
var awei = image.expression(
    '4*(GREEN - SWIR1) - (0.25*NIR + 2.75*SWIR2)', {
      'GREEN': image.select('B3').multiply(0.0001),
      'NIR': image.select('B8').multiply(0.0001),
      'SWIR1': image.select('B11').multiply(0.0001),
      'SWIR2': image.select('B12').multiply(0.0001),
}).rename('awei');
//Map.addLayer(awei);
// Simple Thresholding
var waterMndwi = mndwi.gt(0)
var waterAwei = awei.gt(0)
Map.addLayer(waterMndwi);
Map.addLayer(waterAwei);
// Combining Multiple Conditions
var waterMultiple = ndvi.lt(0).and(mndwi.gt(0))

// Export the image to Drive
Export.image.toDrive({
  image: 'waterMndwi',
  description: 'Mndwi',
  scale: 30,
  region: studyArea
});

1 Answer 1

2

The error is pretty self explanatory: you are trying to export a object that is of type string: 'waterMndwi'. But your export function only takes featureCollections, imageCollections etc. So you have to provide the object without the quotations:

Export.image.toDrive({
  image: waterMndwi,
  description: 'Mndwi',
  scale: 30,
  region: studyArea
});

You probably want to go through some tutorials: https://developers.google.com/earth-engine/tutorials/tutorials

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.