ee.ImageCollection.size
Returns the number of elements in the collection.
Usage | Returns |
---|
ImageCollection.size() | Integer |
Argument | Type | Details |
---|
this: collection | FeatureCollection | The collection to count. |
Examples
// Note: ee.ImageCollection.size may take a lot of time and memory to run,
// since it must generate all of the results in order to count them. Large
// collections and/or complex computations can produce memory limitation
// errors.
// A Landsat 8 TOA image collection (1 year of images at a specific point).
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterBounds(ee.Geometry.Point(-90.70, 34.71))
.filterDate('2020-01-01', '2021-01-01');
// Get the number of images in the collection.
print('Number of images', col.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
# Note: ee.ImageCollection.size may take a lot of time and memory to run,
# since it must generate all of the results in order to count them. Large
# collections and/or complex computations can produce memory limitation
# errors.
# A Landsat 8 TOA image collection (1 year of images at a specific point).
col = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterBounds(
ee.Geometry.Point(-90.70, 34.71)
).filterDate('2020-01-01', '2021-01-01')
# Get the number of images in the collection.
print('Number of images', col.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."],[[["The `size()` function returns the number of elements (e.g., images) in an Earth Engine ImageCollection."],["It takes one argument, the collection to count, and returns an integer representing the number of elements."],["`ee.ImageCollection.size()` can be computationally intensive for large collections, potentially causing memory errors due to the need to generate all results for counting."]]],[]]