Google Earth Engine(GEE)——export影像导出错误Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid

前一段时间RSEI的文章中,大家想下载每一年的RESI的影像,有很多人遇到了影像无法下载的问题,我在这里举个例子,先看问题:

这里的错误: Error: Image. clipToBoundsAndScale, argument ' input': Invalid type. Expected type: Image<unknown bands>. Actual type: ImageCollection. (Error code: 3)

其实,这里需要给大家简单明确一下问题的所在,就是我们要获取的影像下载,而我们通过遍历却获取了很多景影像,所以我们就没有办法下载,其实有一个很好的办法,就用镶嵌,我们要把多景影像镶嵌在一起,然后就可以按照一景影像下载。

 举个例子:

var Years = ee.List.sequence(2000,2020);  // 生成逐年的List
// 逐年进行Map操作,遍历下载影像
var yearlist = Years.getInfo();
print(yearlist); 
var year_imgcol = ee.ImageCollection.fromImages(yearlist.map(function(year) {
    var img = VI.filter(ee.Filter.calendarRange(year, year, 'year')).mosaic();
    var y=img.set({name:ee.String(ee.Number(year).int())})
    Export.image.toDrive({
      image:img,
      description:'rsei'+year.toString(),
      region:sa,
      scale:500,
      maxPixels:1e13
      });
  Map.addLayer(img, ndviVis, 'rsei');
    return img;
}));

就是这句代码:  

 var img = VI.filter(ee.Filter.calendarRange(year, year, 'year'));

 var img = VI.filter(ee.Filter.calendarRange(year, year, 'year')).mosaic(); 

mosaic()

Composites all the images in a collection, using the mask.

使用掩码对一个集合中的所有图像进行合成。

Arguments:

this:collection (ImageCollection):

The collection to mosaic.

Returns: Image

 最后成功了:

 

  • 7
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
GEE 中,`ee.Image.unitScale()` 函数用于将图像像素值缩放到指定的范围内。在设置上限值 `high` 时,需要确保传递给该参数的值是一个 float 类型的数字,如果传递的是其他类型的对象,就会出现 `Invalid type` 的错误。 根据错误提示信息,你传递给 `high` 参数的值是一个对象,而不是 float 类型的数字。实际上,这个对象的值为 null,这也是错误提示信息中提到的 `actual value`。 为了解决这个问题,你需要检查一下你传递给 `high` 参数的值是不是一个 float 类型的数字。如果不是,可以通过将其转换为 float 类型来解决这个问题。例如,可以使用 `ee.Number()` 函数将对象转换为数字,并使用 `toFloat()` 函数将其转换为 float 类型。以下是示例代码: ``` // Load an image from the GEE ImageCollection var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318'); // Scale the image pixel values to the range [0, 1] var scaledImage = image.unitScale(0, 255).toFloat(); // Scale the image pixel values to the range [0, 10] var highValue = ee.Number(10).toFloat(); var scaledImage2 = image.unitScale(0, 255, 0, highValue); // Print the scaled images print('Scaled Image 1:', scaledImage); print('Scaled Image 2:', scaledImage2); ``` 在这个示例中,我们加载了一个 Landsat 8 的图像,并使用 `unitScale()` 函数将其像素值缩放到了两个不同的范围内。在第一个例子中,我们将像素值缩放到了 [0, 1] 范围内,使用了 `toFloat()` 函数将结果转换为 float 类型。在第二个例子中,我们将像素值缩放到了 [0, 10] 范围内,使用了 `ee.Number()` 和 `toFloat()` 函数将高限值转换为 float 类型。最后,我们将结果打印出来。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值