我在 Google Earth Engine 中进行了一些操作,例如:
// Load a cloudy Landsat scene and display it.
var cloudy_scene = ee.Image('LANDSAT/LC8_L1T_TOA/LC80440342014269LGN00');
Map.centerObject(cloudy_scene);
Map.addLayer(cloudy_scene, {bands: ['B4', 'B3', 'B2'], max: 0.4}, 'TOA', false);
// Add a cloud score band. It is automatically called 'cloud'.
var scored = ee.Algorithms.Landsat.simpleCloudScore(cloudy_scene);
// Create a mask from the cloud score and combine it with the image mask.
var mask = scored.select(['cloud']).lte(20);
// Apply the mask to the image.
var masked = cloudy_scene.updateMask(mask);
现在我想使用方法Export.image.toDrive
将结果(masked
)导出到Google Drive,但我不知道如何指定参数region
满足与原始图像 LANDSAT/LC8_L1T_TOA/LC80440342014269LGN00
相同的要求。
请帮助我构建这个区域。
最佳答案
我认为这就是您正在寻找的:
Export.image.toDrive({
image:masked.select('B3'),
description: 'Masked_Landsat_Image',
region:masked.geometry(),
scale:mask.projection().nominalScale().getInfo()
})
在本例中,我使用图像的足迹(使用 image.geometry()
)来定义导出区域。
请注意,我使用函数 mask.projection().nominalScale().getInfo()
来导出导出的比例(分辨率)。这可以确保我使用图像的原始分辨率(在本例中为 30m)。您需要将 getInfo
添加到函数中才能实际从服务器检索整数。
您也可以只指定 30 或任何其他所需的分辨率(以米为单位)。
HTH
<小时/>编辑:
只是对我在下面的评论中所写内容的视觉辅助:
3 张图片:
- 原始 LS 图像的左上角(从 EarthExplorer 下载)- 红色
表示
NoData
- 来自 GEE 的 LS 图像位于原始图像之上(GEE 图像具有红色像素) - 您可以清楚地看到原始图像中仍然存在 GEE 版本中缺失的
NoData
部分。我担心的是像素排列得不太好。
- 两张图片的右上角:在这里您可以看到两张图片相距多远
关于javascript - 谷歌地球引擎: Region of Landsat Image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43773240/