Image collection overview
Getting Started with Earth Engine ImageCollection
As illustrated in the Get Started section and the ImageCollection Information section, Earth Engine provides a variety of convenience methods for filtering image collections. Specifically, many common use cases are handled by imageCollection.filterDate()
, and imageCollection.filterBounds()
. For general purpose filtering, use imageCollection.filter()
with an ee.Filter as an argument. The following example demonstrates both convenience methods and filter()
to identify and remove images with bad registration from an ImageCollection
:
In [ ]:
import ee
import geemap
In [ ]:
Map = geemap.Map()
Map
Get collection size¶
In [ ]:
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
In [ ]:
print(collection.size().getInfo())
Get the first image¶
In [ ]:
image = collection.first()
geemap.image_props(image).getInfo()
In [ ]:
Map.addLayer(image, {}, "First image")
Map.centerObject(image, 6)
Map
In [ ]:
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') \
.filterDate('2020-01-01', '2020-12-31')
In [ ]:
print(collection.size().getInfo())
In [ ]:
image2 = collection.first()
Map.addLayer(image2, {}, "Another image")
Map.centerObject(image2, 6)
Map
In [ ]:
roi = ee.Geometry.Point(-122.4488, 37.7589)
In [ ]:
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') \
.filterDate('2020-01-01', '2020-12-31') \
.filterBounds(roi)
In [ ]:
print(collection.size().getInfo())
In [ ]:
Map = geemap.Map()
image = collection.first()
vis_param = {'min': 0,
'max': 2000,
'bands': ['B5', 'B4', 'B3'],
'gamma': 1.5}
Map.addLayer(image, vis_param, "First mage")
Map.centerObject(image, 8)
Map
In [ ]:
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') \
.filterDate('2020-01-01', '2020-12-31') \
.filterBounds(ee.Geometry.Point(-122.4488, 37.7589)) \
.filterMetadata('CLOUD_COVER', 'less_than', 10) \
.sort("CLOUD_COVER")
In [ ]:
Map = geemap.Map()
image = collection.first()
vis_param = {'min': 0,
'max': 2000,
'bands': ['B5', 'B4', 'B3'],
'gamma': 1.5}
Map.addLayer(image, vis_param, "First mage")
Map.centerObject(image, 8)
Map
In [ ]:
geemap.image_props(image).getInfo()
Get image collection properties¶
In [ ]:
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR') \
.filterDate('2020-01-01', '2020-12-31') \
.filterBounds(ee.Geometry.Point(-122.4488, 37.7589)) \
.filterMetadata('CLOUD_COVER', 'less_than', 10)
In [ ]:
collection.aggregate_array('CLOUD_COVER').getInfo()
In [ ]:
collection.aggregate_array('system:id').getInfo()
In [ ]:
collection.aggregate_mean('CLOUD_COVER').getInfo()
Last update: 2021-03-17