Send feedback
ee.ImageCollection.toList
Stay organized with collections
Save and categorize content based on your preferences.
Returns the elements of a collection as a list.
Usage Returns ImageCollection. toList (count, offset )
List
Argument Type Details this: collection
FeatureCollection The input collection to fetch. count
Integer The maximum number of elements to fetch. offset
Integer, default: 0 The number of elements to discard from the start. If set, (offset + count) elements will be fetched and the first offset elements will be discarded.
Examples
Code Editor (JavaScript)
// Note: ee.ImageCollection.toList may take a lot of time and memory to run,
// since it must generate all of the results in order to gather them into a
// list. 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' );
print ( 'Image collection' , col );
// Get the first 3 images as a list of images.
var imgListFirst3 = col . toList ( 3 );
print ( 'First 3 images' , imgListFirst3 );
// Get the second 3 images as a list of images (use the offset parameter).
var imgListSecond3 = col . toList ( 3 , 3 );
print ( 'Second 3 images' , imgListSecond3 );
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)
# Note: ee.ImageCollection.toList may take a lot of time and memory to run,
# since it must generate all of the results in order to gather them into a
# list. 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' )
print ( 'Image collection:' , col . getInfo ())
# Get the first 3 images as a list of images.
img_list_first3 = col . toList ( 3 )
print ( 'First 3 images:' , img_list_first3 . getInfo ())
# Get the second 3 images as a list of images (use the offset parameter).
img_list_second3 = col . toList ( 3 , 3 )
print ( 'Second 3 images:' , img_list_second3 . getInfo ())
Send feedback
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.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["`toList` retrieves elements from an ImageCollection and returns them as a List."],["It allows you to specify the maximum number of elements to fetch using the `count` parameter."],["You can control the starting position for element retrieval with the optional `offset` parameter."],["It's important to note that `toList` can be resource-intensive for large collections, potentially leading to memory limitations."]]],[]]