0

I am trying to download images from Landsat's EVI collection off of Google Earth Engine. I saw another similar post here: EVI or NDVI collection image download that talked about the same issue. One response was to create a "for loop", which I have done. When I run my code though, nothing happens. I get no errors but also nothing is downloaded and there are no tasks. What am I doing wrong? I am new to google earth engine.

// Exporting Landsat 8 Images

var roi = ee.Geometry.Rectangle([-150.0, 8.0, -34.0, 84.0]);

// Load EVI collection
var eviCol = ee.ImageCollection("LANDSAT/LC08/C01/T1_8DAY_EVI") 
.filterDate('2022-05-01', '2022-08-31')
.filterBounds(roi)
.sort('CLOUD_COVER')
.select('EVI');

var eviList = eviCol.toList(eviCol.size());

var colorizedVis = {
  min: 0,
  max: 1,
  palette: [
    'ffffff', 'ce7e45', 'df923d', 'f1b555', 'fcd163', '99b718', '74a901',
    '66a000', '529400', '3e8601', '207401', '056201', '004c00', '023b01',
    '012e01', '011d01', '011301'
  ],
};

for (var i = 0; i < eviCol.size().getInfo; i++) {
  var image = ee.Image(eviList.get(i));
 
  // Add the colorized EVI layer to the map
  Map.addLayer(image.clip(roi), colorizedVis, 'Colorized');
  
  // Export to Drive with consistent visualization settings
  Export.image.toDrive({
    image: image,
    description: 'Landsat2022_NA' + i,
    scale: 30,
    region: roi,
  });
}

1 Answer 1

1

There are three issues with your code in the dataset and the for loop.

  1. According to the documentation, there is no data after 2022-01-01. However, you have given date range after that period.

  2. There is no 'CLOUD_COVER' property in the image collection. You can check from the documentation.

  3. In the for loop, parenthesis is missing after the getInfo() method. The correct one would be eviCol.size().getInfo()

1
  • This worked. Thank you! I see what you are saying about the date availability and cloud cover properties now. I will be sure to double check these details in the future. Commented Sep 15, 2023 at 18:53

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.