ee.ImageCollection.size

返回集合中的元素数量。

用法返回
ImageCollection.size()整数
参数类型详细信息
此:collectionFeatureCollection要统计的集合。

示例

代码编辑器 (JavaScript)

// 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 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

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