GEE影像分段拉伸
2019-01-03 本文已影响0人
赤豆冰棍
在特定影像值范围内,显示影像,范围外的值均被替换为最低值或最高值
主要功能
使用SRTM数据,实现1000到2000米高程内数据的展示
代码
// ee.Image.clamp() example.
// Clamp the values of all bands in an image to lie within the specified range.
// Values below the low value of that range are set to low value, values above
// the high value of that range are set to the high value.
var image = ee.Image('CGIAR/SRTM90_V4');
var clamped = image.clamp(1000, 2000);
Map.setCenter(-121.753, 46.855, 9);
Map.addLayer(image, {min: 0, max: 4300}, 'Full stretch');
Map.addLayer(clamped, {min: 0, max: 4300}, 'Clamped');
步骤分析
- 创建ee对象,获取SRTM数据
- 在[1000,2000]范围内对SRTM数据进行拉伸
- 设置地图显示中心,缩放等级
- 添加原始图层
- 添加拉伸结果图层
主要方法
- ee.Image.clamp()
Clamps the values in all bands of an image to all lie within the specified range.
Arguments:
this:input (Image):
The image to clamp.
low (Float):
The minimum allowed value in the range.
high (Float):
The maximum allowed value in the range.
Returns: Image
拉伸指定值域范围内的数据,值域外进行掩膜。
输入参数:
输入影像对象,最小值,最大值