【问题标题】:Is it possible to get download URLs for each image in image collection using Earth Engine API for python?是否可以使用 Earth Engine API for python 获取图像集中每个图像的下载 URL?
【发布时间】:2019-11-25 06:39:21
【问题描述】:

我之前看到过这个问题,但似乎专注于导出到 GDrive,我想将图像导出/下载到我的计算机而不是谷歌驱动器。

我正在尝试使用地球引擎的 python api 从图像集中下载每个图像。

按照他们的示例,抓取一张图片并获取下载 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)

这给了我一个可以下载图片的 URL。

对于图像集合,我可以使用以下方法获取图像集合:

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

是否可以遍历每个图像并获取每个下载 URL? IE。想在不使用谷歌驱动器的情况下每月抓取一次相同区域的图像或类似的东西。现在我的问题很简单,但会在下载之前将图像剪辑到我的区域并根据需要执行其他操作。

我在这里发现了这个问题:How to iterate over and download each image in an image collection from the Google Earth Engine python api

但未能提出最终解决方案...

我们将不胜感激!

【问题讨论】:

    标签: python api download google-earth-engine satellite-image


    【解决方案1】:

    你可以这样做:

    
        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)
    

    您可以检查我基于上述代码的代码。 它在 javascript 中,但概念相同 https://github.com/Yichabod/natural_disaster_pred/blob/master/image_download_script.js .注释掉的代码就是你感兴趣的地方

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-13
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-29
      • 2012-05-19
      相关资源
      最近更新 更多