我有一个关于从GEE导出数据的问题。我是编码和GEE的新手。我想要实现的是导出使用Fusion Table上传的点a的像素带数据。 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"]
});
所以你想要的是一个名为samplesRegions的函数,用于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']);