ee.FeatureCollection.aggregate_histogram

对集合中对象的给定属性进行汇总,计算所选属性的直方图。

用法返回
FeatureCollection.aggregate_histogram(property)字典
参数类型详细信息
此:collectionFeatureCollection要汇总的集合。
property字符串要从集合的每个元素中使用的属性。

示例

代码编辑器 (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
             .filter('country_lg == "Belgium"');

print('Histogram of power plant capacities (MW)',
      fc.aggregate_histogram('capacitymw'));  // Dictionary

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

from pprint import pprint

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

print('Histogram of power plant capacities (MW):')
pprint(fc.aggregate_histogram('capacitymw').getInfo())  # Dictionary