ee.FeatureCollection.size

傳回集合中的元素數量。

用量傳回
FeatureCollection.size()整數
引數類型詳細資料
這個:collectionFeatureCollection要計算的集合。

範例

程式碼編輯器 (JavaScript)

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

print('Number of power plants in Belgium', fc.size());

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

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('Number of power plants in Belgium:', fc.size().getInfo())