Google Earth Engine —— 一个简单的地图分类加载和图表显示(group函数的使用和分析)

我们这里再进行简单的区域分类,然后按照面积分别进行统计和分析,最后给出柱状直方图的图表进行展示,同时过程中我们用到了reduceregion函数来进行面积的统计,而面积统计中我们可以看到,我们用到的group来进行将统计后的结果进行以一个组的形式呈现。我们先看函数:

group(groupFieldgroupName)

Groups reducer records by the value of a given input, and reduces each group with the given reducer.按给定输入的值对 reducer 记录进行分组,并使用给定的 reducer 统计每个组。

Arguments:

this:reducer (Reducer):

The reducer to apply to each group, without the group field.

groupField (Integer, default: 0):

The field that contains record groups.

groupName (String, default: "group"):

The dictionary key that contains the group. Defaults to 'group'.

Returns: Reducer

var area = ee.Image.pixelArea().divide(10000).addBands(CS_2020)
  .reduceRegion({
    reducer: ee.Reducer.sum(), 
    geom

猜你喜欢

转载自blog.csdn.net/qq_31988139/article/details/128742950
今日推荐