ee.FeatureCollection.size
Returns the number of elements in the collection.
Usage | Returns |
---|
FeatureCollection.size() | Integer |
Argument | Type | Details |
---|
this: collection | FeatureCollection | The collection to count. |
Examples
// 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
# 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())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["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."]]],["The `size()` method calculates the number of elements within a `FeatureCollection`. It takes the collection as input and returns an integer representing the total count. For instance, when applied to a `FeatureCollection` of power plants in Belgium, `fc.size()` returns the number of power plants. Examples provided demonstrate its usage in both JavaScript and Python environments, showcasing how to retrieve and print the collection's size.\n"]]