【问题标题】:How to subset an image collection in Google Earth Engine based on their position?如何根据位置在 Google 地球引擎中对图像集合进行子集化?
【发布时间】:2019-08-25 20:41:04
【问题描述】:

我是新的 Google 地球引擎用户。我正在尝试删除图像集合的一些图像。在下面的例子中是一个例子。我的图片集有更多图片。

 // Load Landsat 8 brightness temperature data for 1 year.
 var test = ee.ImageCollection('LANDSAT/LC8_L1T_32DAY_TOA')
.filterDate('2012-12-25', '2016-12-25')
.select('B1');
print(test)

我的图片集有 45 张图片。为了清楚起见,我将 index1 称为我的第一张图像,将 index45 称为我的最后一张图像,等等。我如何保留或删除从 index10 到 index 15 以及从 index30 到 index40 的图像。

我尝试使用列表,但无法捕获元素。

【问题讨论】:

    标签: javascript image filtering google-earth-engine satellite


    【解决方案1】:

    您可以使用以下函数按元数据过滤集合。

    .filterMetadata(name, operator,value)
    

    如果您要保留的图像具有相同的值,那么您可以使用它。例如,要按 WRS_ROW 和 WRS_PATH 进行过滤,您可以执行以下操作。

    var testFiltered = test.filterMetadata("WRS_ROW","equals",15)
                           .filterMetadata("WRS_PATH","equals",36)
    

    只需选择最适合您的元数据。最好不要按数字选择,否则其他年份就不行了。

    【讨论】:

      【解决方案2】:

      除了按元数据属性(如 WRS-2 路径和行)进行过滤外,您还可以对集合运行方法 .filterBounds(geometry),它将生成一个新集合,其中仅包含与几何相交的元素。这是一个例子:

      // Load Landsat 8 TOA data.
      var timeFiltered = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
          .filterDate('2013-01-01', '2014-01-01');
      
      // define an ee.Geometry to filter by
      // San Francisco Lon/Lat
      var geom = ee.Geometry.Point([122.4194, 37.7749]);
      
      // filter by a geometry
      var spaceTimeFiltered = timeFiltered.filterBounds(geom);
      
      print('Before spatial filtering: ',timeFiltered);
      print('After spatial filtering: ',spaceTimeFiltered);
      

      在这种情况下,仅按时间过滤的集合不会打印,因为它有 5000 多个元素,但是当您按空间和时间过滤时,它会返回 2013 年旧金山上空的 15 个场景。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-10-07
        • 1970-01-01
        • 1970-01-01
        • 2019-05-21
        • 1970-01-01
        • 2023-03-22
        • 1970-01-01
        • 2011-03-29
        相关资源
        最近更新 更多