AI-generated Key Takeaways
-
ee.ImageCollection
can be constructed from a variety of inputs, including a string representing a collection name, a list of images, or a single image. -
Using a string as input, such as a collection name like 'COPERNICUS/S2_SR', allows you to create an ImageCollection directly from that dataset.
-
When providing a list of images or a single image, the
ee.ImageCollection
constructor creates a collection containing those specified elements. -
Computed objects are also valid inputs, and they are reinterpreted as a collection when used to create an
ee.ImageCollection
.
- A string: assumed to be the name of a collection,
- A list of images, or anything that can be used to construct an image.
- A single image.
- A computed object - reinterpreted as a collection.
Usage | Returns |
---|---|
ee.ImageCollection(args) | ImageCollection |
Argument | Type | Details |
---|---|---|
args | ComputedObject|Image|List<Object>|String | The constructor arguments. |
Examples
Code Editor (JavaScript)
print('Image collection from a string', ee.ImageCollection('COPERNICUS/S2_SR').limit(3)); var img1 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNK'); var img2 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNL'); var img3 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNM'); print('Image collection from a list of images', ee.ImageCollection([img1, img2, img3])); print('Image collection from a single image', ee.ImageCollection(img1));
import ee import geemap.core as geemap
Colab (Python)
print('Image collection from a string:', ee.ImageCollection('COPERNICUS/S2_SR').limit(3).getInfo()) img1 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNK') img2 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNL') img3 = ee.Image('COPERNICUS/S2_SR/20170328T083601_20170328T084228_T35RNM') print('Image collection from a list of images:', ee.ImageCollection([img1, img2, img3]).getInfo()) print('Image collection from a single image:', ee.ImageCollection(img1).getInfo())