我对从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"]
});
答案 0 :(得分:0)
所以,您想要的是一个用于ee.Image对象的名为sampledRegions的函数。
在您的情况下,会是这样
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']);