1

I've seen this question asked before but seemed to be focused on exporting to GDrive, I want to export/download the images to my computer rather than google drive.

I am trying to download each image from a image collection using earth engine's python api.

Following their examples, it is easy enough to grab a single image and get the download URL:

image1 = ee.Image('CGIAR/SRTM90_V4')
path = image1.getDownloadUrl({
    'scale': 30,
    'crs': 'EPSG:4326',
    'region': '[[-120, 35], [-119, 35], [-119, 34], [-120, 34]]'})
print(path)

This gives me a URL from which I can download the image.

Similarly for an image collection, I can get the image collection using:

collection = (ee.ImageCollection('LANDSAT/LE07/C01/T1')
              .filterDate(datetime.datetime(2002, 11, 8),
                          datetime.datetime(2002, 11, 15)))

Is it possible to iterate through each image and get each download URL? I.e. want to grab imagery of the same area once a month or something like that without using google drive. For now I left the question simple, but will clip the image to my area and perform other manipulations as necessary before download.

I found this question here: How to iterate over and download each image in an image collection from the Google Earth Engine python api

but wasn't able to come up with a final solution...

Help would be appreciated!

Derek Eden
  • 4,403
  • 3
  • 18
  • 31

1 Answers1

0

You can do this:


    data = images.toList(images.size());
    for i in range(43): #This is the number of images in the images collection
      image = ee.Image(data.get(i));
      #image = image.select(["B2","B3","B4","B8","B12"])
      path = image.getDownloadUrl({
      'scale' : scale,
      'crs' : 'EPSG:4326',
      'region' : polys})
    
      print(path)

You could check this code which I based the above code from. It is in javascript, but the same concept https://github.com/Yichabod/natural_disaster_pred/blob/master/image_download_script.js . The commented out code is what you are interesed in

salRad
  • 320
  • 1
  • 8
  • 21