Google Earth Engine – How to Export Large Number of Images

google-earth-engine

In my analysis on Google Earth Engine, I want to export a large number of image files to drive. In general, for this, we can use a for loop to loop through the images and export them with Export.image.toDrive method.

  Export.table.toDrive(image_ndvi, 'ndvi', 'LST Paper/Indiecs');

But this method put those images in the Task Manager (Tasks tab) and we have to manually click run two times for each image. I have around 145 single-band remote sensing indices and surface temperature images of the same area, so this process is not very efficient for me.

I have done all the analysis in GEE and want to export the output images so that I can create maps for my report.

How do I export these many images at once?

Best Answer

There is one batch tool https://github.com/gee-hydro/gee_monkey, but it did not work very well for me. Or consider stacking all the images into one following the instructions at Layer stacking images in Earth Engine? using a loop, and exporting just that one image.

var imgList = aImgCollection.toList(aImgCollection.size());

var id = 0;

var firstImage = ee.Image( imgList.get(id) );

// these two lines use the image ID to rename each band to make sure they are different
var filename = ee.String("rename_").cat(firstImage.id().getInfo()).getInfo();
firstImage = firstImage.rename(filename);
id = id + 1;

while (id < aImgCollection.size().getInfo()){
  var aImage = ee.Image( imgList.get(id) );

  // these two lines use the image ID to rename each band to make sure they are different
  filename = ee.String("rename_").cat(aImage.id().getInfo()).getInfo();
  aImage = aImage.rename(filename);

  firstImage = firstImage.addBands(aImage); 
  
  id = id + 1;
}