ee.FeatureCollection.size

Trả về số lượng phần tử trong tập hợp.

Cách sử dụngGiá trị trả về
FeatureCollection.size()Số nguyên
Đối sốLoạiThông tin chi tiết
this: collectionFeatureCollectionBộ sưu tập cần đếm.

Ví dụ

Trình soạn thảo mã (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());

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

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())