ImageCollections are stacks of images organized by time and space. They let you filter by date, location, and metadata, then map functions or reduce to composites.
Learning objectives
- Load an
ImageCollectionby ID. - Filter by date, bounds, and metadata (cloud cover).
- Extract a single image and build a simple composite.
- Inspect collections without overwhelming the console.
Why it matters
Most analyses start with an ImageCollection. Filtering and compositing correctly saves
time, reduces cloud contamination, and keeps scripts efficient.
Quick win: filter, inspect, composite
// Load Landsat 8 SR and filter
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterBounds(ee.Geometry.Point([-82.3, 29.6]))
.filterDate('2023-06-01', '2023-07-01')
.filter(ee.Filter.lt('CLOUD_COVER', 20));
print('Count after filters', col.size());
var first = col.first();
Map.centerObject(first, 9);
Map.addLayer(first, {bands: ['SR_B4', 'SR_B3', 'SR_B2'], min: 0.02, max: 0.3}, 'First image');
// Median composite to reduce clouds
var median = col.median();
Map.addLayer(median, {bands: ['SR_B4', 'SR_B3', 'SR_B2'], min: 0.02, max: 0.3}, 'Median composite');
What you should see
A single scene and a cleaner median composite; console showing a small collection count.
Key concepts
filterDate(): time window.filterBounds(): spatial filter.filter(): metadata filters (for example,CLOUD_COVER).first(): grab one image for debugging.median()/mean(): simple cloud-resistant composites.
Try it: refine your stack
Add .sort('CLOUD_COVER') and view the first image.
Print col.aggregate_histogram('CLOUD_COVER') to see quality distribution.
Swap to Sentinel-2 SR and adjust band names accordingly.
Common mistakes
- Printing huge collections before filtering-filter first, then inspect.
- Forgetting to scale/offset surface reflectance products before visualization.
- Using
first()on an unfiltered collection and getting a cloudy scene.
Quick self-check
- What does
filterBounds()do? - Why use
median()on a collection? - How would you remove images with
EO:cloud_covergreater than 10?
Next steps
- Apply cloud masking to each image with
.map()before compositing. - Export a median composite at a specified scale (see Week 04 exports).
- Explore other collections in the Data Catalog.