Google Earth Engine(GEE)——Error: Exported bands must have compatible data types; found inconsistent

错误:

Error: Exported bands must have compatible data types; found inconsistent types: Int16 and Byte. (Error code: 3) 

这个问题的来源于博客:

(400条消息) Google Earth Engine(GEE)——利用归一化建筑指数NDBI(不透水层)提取建筑物_此星光明2021年博客之星云计算Top3的博客-CSDN博客_ndbi提取建筑物

原有的下载代码:

//下载影像
Export.image.toDrive({
  image: scol_clip,
  description: '2011_sr',
  folder: 'training02',
  scale: 30,
  crs:'EPSG:4326',
  region:hh
});

 我们看到当我们运行到这个结果的时候会出现这个问题:这里scol_clip打印出来的结果是image类型,而我们下载的image是一个整个image,所以就无法识别,我们需要改进一下下载的代码。我们可以直接选择我们要下载的波段进行下载就行了,因为每一个波段都是整形,这样就把上面的问题解决了。

修改后的代码:

//方法1不选择波段,全波段影像下载
Export.image.toDrive({
  image: scol_clip.select("NDBI").int16(),
  description: '2011_sr',
  folder: 'training02',
  scale: 30,
  crs:'EPSG:4326',
  region:hh
});

//方法2不选择波段,只选择NDBI波段,这样默认就是整形
Export.image.toDrive({
  image: scol_clip.select("NDBI"),
  description: '2011_sr',
  folder: 'training02',
  scale: 30,
  crs:'EPSG:4326',
  region:hh
});

猜你喜欢

转载自blog.csdn.net/qq_31988139/article/details/123908853