上一篇当中有介绍直接通过波段运算,但是更好的方式是通过内置的算法来实现,这样适配性问题会更好一些
normalizedDifference(bandNames)
Computes the normalized difference between two bands. If the bands to use are not specified, uses the first two bands. The normalized difference is computed as (first − second) / (first + second). Note that negative input values are forced to 0 so that the result is confined to the range (-1, 1).计算两个波段之间的归一化差异。如果没有指定要使用的频段,则使用前两个频段。归一化差值的计算方法是(第一-第二)/(第一+第二)。注意,负的输入值被强制为0,这样结果就被限制在(-1,1)的范围内。
Arguments:
this:input (Image):
The input image.
bandNames (List, default: null):
A list of names specifying the bands to use. If not specified, the first and second bands are used.
Returns: Image
Map.setOptions("SATELLITE");
var image