GEE入门 | 重采样

GEE入门 | 重采样

函数

Image.reproject(crs, crsTransform, scale)
输出为image

参数:

Argument Type Details
this: image Image The Image to reproject.
crs Projection The CRS to project the image to.
crsTransform List, default: null The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with the scale option, and replaces any transform already on the projection.
scale Float, default: null If scale is specified, then the projection is scaled by dividing the specified scale value by the nominal size of a meter in the specified projection. If scale is not specified, then the scale of the given projection will be used.

例子

这里将Sentinel-2影像重采样到100m作为例子。
P.S. 一般引入GEE数据库显示的分辨率一开始都是111319.490……

javascript

function maskS2clouds(image) {
   
  var qa = image.select('QA60');

  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(qa.bitwiseAnd(cirrusBitMask).eq(0));

  return
是的,Google Earth Engine(GEE)提供了重采样功能,可以将影像数据从一个分辨率/尺度转换为另一个分辨率/尺度。重采样可以根据需要增加或减少影像数据的空间分辨率,使其与其他数据集或分析需求匹配。 在GEE中,可以使用`resample()`函数来执行重采样操作。该函数接受两个参数:目标分辨率和重采样方法。目标分辨率可以是具体的数值,也可以是一个影像对象。重采样方法可以是以下选项之一: - `bilinear`:双线性插值 - `bicubic`:双三次插值 - `nearest`:最近邻插值 以下是使用GEE进行重采样的示例代码: ```javascript // 加载影像 var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_123032_20140515'); // 设置目标分辨率 var targetResolution = 30; // 目标分辨率为30米 // 执行重采样 var resampledImage = image.resample('bilinear').reproject({ crs: image.projection(), scale: targetResolution }); // 打印原始和重采样后的分辨率 print('原始分辨率:', image.projection().nominalScale()); print('重采样后的分辨率:', resampledImage.projection().nominalScale()); // 可以继续进行其他操作,如计算指标或导出数据 ``` 上述代码将加载一个Landsat 8影像,然后使用`resample()`函数将其重采样为30米的分辨率。您可以根据自己的需求调整目标分辨率和重采样方法。重采样后的影像可以用于进一步的分析、计算指标或导出数据。
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值