ee.FeatureCollection.aggregate_first

对集合中对象的指定属性进行聚合,计算集合中第一个对象的属性值。

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

示例

代码编辑器 (JavaScript)

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

print('Fuel source for first power plant in the collection',
      fc.aggregate_first('fuel1'));  // Wind

Python 设置

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

import ee
import geemap.core as geemap

Colab (Python)

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

print('Fuel source for first power plant in the collection:',
      fc.aggregate_first('fuel1').getInfo())  # Wind