【问题标题】:Extracting band values of multiple points in GEE提取GEE中多个点的波段值
【发布时间】:2019-04-01 13:07:43
【问题描述】:

我有一个关于从 GEE 导出数据的问题。我是编码和 GEE 的新手。我想要实现的是导出已使用 Fusion Table 上传的点的像素带数据。 GEE是否可以将这些点的波段数据以表格的形式导出?

到目前为止我的代码:https://code.earthengine.google.com/8a764b5d22a9f7108152fce1acc1fe16

代码:

// Load a FeatureCollection from a Fusion Table
var CRuHM_small_data = ee.FeatureCollection('ft:1ocXhbAqP_NbA0iE7tivKgKCfTFGseNdibklZj0NX');

// Print and display the FeatureCollection.
Map.addLayer(CRuHM_small_data,{},'CRuHM_small_data');
print(CRuHM_small_data);

//Navigate to area of interest
Map.setCenter(17.3834, -0.8929, 8);

// Select a specific Sentinel-2 image from the archive
var sent2a = ee.Image("COPERNICUS/S2/20170801T090021_20170801T091620_T33MYV");

// Add RGB composite to map, for water/land
Map.addLayer(sent2a,{bands:['B8','B11','B4'], min:0, max:3000}, "water/land");

However, the next step is more complicated for me. 
I was trying this code, but something is missing:(

//exporting band data to table
//Export.table.toDrive(collection, description, folder, 
//fileNamePrefix, fileFormat, selectors),

Export.table.toDrive({
  collection: CRuHM_small_Data,
  description: "CRuHM_small_Data",
  folder: "GEE",
  fileNamePrefix: "Table",
  fileFormat: "CSV",
  selectors: ["ID", "B3", "B2"]
  });

【问题讨论】:

  • 为什么这个标签是 google-fusion-tables?将于 2019 年 12 月 3 日关闭/关闭
  • 因为通过 Fusion Table 创建并传输到 GEE 的点。如果你愿意,我可以删除那个标签。

标签: google-fusion-tables google-earth-engine


【解决方案1】:

所以你想要的是一个名为 sampledRegions 的函数,用于 ee.Image 对象。

在你的情况下是这样的

var sampledData = sent2a.sampleRegions({
  collection:CRuHM_small_data,
  scale:10
});

Export.table.toDrive({
  collection: sampledData,
  description: "CRuHM_small_Data",
  folder: "GEE",
  fileNamePrefix: "Table",
  fileFormat: "CSV",
  selectors: ["ID", "B3", "B2"]
});

由于您需要有关点的波段信息,因此您必须使用点对波段进行采样,然后导出采样点。

此外,由于您似乎只尝试从 B2 和 B3 导出信息,因此最好在采样前对图像进行选择。

在您的 sampleRegions 之前的某处类似以下内容应该可以解决问题。

sent2a = sent2a.select(['B2', 'B3']);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-25
    • 2020-02-14
    • 2019-12-31
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2021-08-26
    • 2022-12-04
    相关资源
    最近更新 更多