ee.FeatureCollection.size

  • Returns the number of elements (features) within a given FeatureCollection.

  • The method is called using size() on a FeatureCollection and returns an Integer value.

  • Usage examples are provided in JavaScript and Python demonstrating how to retrieve the size of a FeatureCollection.

Returns the number of elements in the collection.

UsageReturns
FeatureCollection.size()Integer
ArgumentTypeDetails
this: collectionFeatureCollectionThe collection to count.

Examples

Code Editor (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 setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

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