javascript - 映射函数的参数不能用于客户端操作
问题描述
我正在尝试使用平台提供的Google Earth Studio将 Google Earth Engine 图像导出到 Google 驱动器。导出图像的官方指南如下
// Load a landsat image and select three bands.
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515')
.select(['B4', 'B3', 'B2']);
// Create a geometry representing an export region.
var geometry = ee.Geometry.Rectangle([116.2621, 39.8412, 116.4849, 40.01236]);
// Export the image, specifying scale and region.
Export.image.toDrive({
image: landsat,
description: 'imageToDriveExample',
scale: 30,
region: geometry
});
上面的代码可以导出图像,但我需要导出特定坐标的图像,而不是
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515')
.select(['B4', 'B3', 'B2']);
我正在使用以下代码,
var landsat = ee.ImageCollection("LANDSAT/LT05/C01/T1_SR")
var point = ee.Geometry.Point([73.0479, 33.6844]);
代码成功执行,但是当我尝试运行任务以完成该过程时,出现以下错误,
映射函数的参数不能用于客户端操作
有人可以帮助我吗,我在这里做错了什么?谢谢
解决方案
夫妇的事情。首先,你想把你的观点放在哪里?因为现在它位于北冰洋。其次,当我执行你的代码时,它可以工作,但是当它在北极海导出一个 1x1 像素的陆地卫星图像时,它是空的。所以你必须在寻找别的东西。由于您的陆地卫星显示靠近北京的区域,我更改了 ee.Point 坐标以匹配。
您想在这一点上导出 landsat 值吗?然后试试这个:
// Load a landsat image and select three bands.
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_123032_20140515')
.select(['B4', 'B3', 'B2']);
Map.addLayer(landsat, {}, 'landsat image')
// Create a geometry representing an export region.
var geometry = ee.Geometry.Rectangle([116.2621, 39.8412, 116.4849, 40.01236]);
var point = ee.Geometry.Point([116.5632, 40.2404]);
var LandsatAtPoint = landsat.reduceRegions({
collection: point,
reducer: ee.Reducer.mean(),
scale: 30 // resolution of the bands is 30m
})
print(LandsatAtPoint)
// Export the image, specifying scale and region.
Export.table.toDrive({
collection: LandsatAtPoint,
description: 'imageToDriveExample',
});
以表格格式导出图像的值而不是 1x1 像素图像更有意义。因此我Export.image.toDrive
改为Export.table.toDrive
推荐阅读
- javascript - 将 id-keyed 对象转换为数组
- vba - 如果 findelementbypartialtext=false 则跳转
- php - 查询产生数据,但导出为空白
- kubernetes - 大使边缘堆栈:设置主机优先于通配符主机
- python - 在 Keras 中使用 SupervisedContrastiveLoss 时出现 InvalidArgumentError
- node.js - Handlebars Puppeteer 文档中的边距并不总是被识别
- python - redis.exceptions.ConnectionError:连接到 localhost:6379 时出现错误 99。无法分配请求的地址
- php - 下拉vue组件中的选定值
- python - 从列表中查找最长的唯一条目
- python - 迁移学习后的前一个模型的类