AI-generated Key Takeaways
-
An image collection in Earth Engine is a set of images, like the collection of all Landsat 8 images, and can be found and imported using the Earth Engine data catalog and Code Editor.
-
Image collections representing large datasets, such as all Landsat 8 scenes, can be filtered by spatial location or acquisition date to work with a specific subset of images.
-
Individual images within a filtered collection can be inspected or programmatically accessed by sorting the collection based on metadata properties like cloud cover.
-
When displaying multi-band images or image collections on a map, it's important to specify visualization parameters like which bands to use and the min/max values for stretching to achieve desired true-color or false-color composites.
-
Adding an image collection to the map displays a recent-value composite by default, showing the most recent pixels and potentially revealing discontinuities and clouds from different acquisition times.
An image collection refers to a set of Earth Engine images. For example, the collection
of all Landsat 8 images is an ee.ImageCollection
. Like the SRTM image
you have been working with, image collections also have an ID. As with single images,
you can discover the ID of an image collection by searching the Earth Engine data catalog
from
the Code Editor and looking at the details page of the dataset. For example, search for
'landsat 8 toa' and click on the first result, which should correspond to the USGS Landsat 8 Collection 1 Tier 1 TOA Reflectance
dataset.
Either import that dataset using the Importbutton and rename it to l8
, or copy the ID into the
image collection constructor:
Code Editor (JavaScript)
var l8 = ee . ImageCollection ( 'LANDSAT/LC08/C02/T1_TOA' );
Filtering image collections
It's worth noting that this collection represents every
Landsat 8 scene collected,
all over the Earth. Often it is useful to extract a single image, or subset of images,
on which to test algorithms. The way to limit the collection by time or space is by
filtering it. For example, to filter the collection to images that cover a particular
location, first define your area of interest
with a point (or line or polygon) using the geometry drawing tools. Pan to your area of
interest, hover on the Geometry Imports(if you already have one or more
geometries defined) and click +new layer(if you don't have any imports,
go to the next step). Get the point drawing tool
(
) and make a point in your area of
interest. Name the import point
. Now, filter the l8
collection
to get only
the images that intersect the point, then add a second filter to
limit the collection to only the images that were acquired in 2015:
Code Editor (JavaScript)
var spatialFiltered = l8 . filterBounds ( point ); print ( 'spatialFiltered' , spatialFiltered ); var temporalFiltered = spatialFiltered . filterDate ( '2015-01-01' , '2015-12-31' ); print ( 'temporalFiltered' , temporalFiltered );
Here, filterBounds()
and filterDate()
are shortcut methods for
the more general filter()
method on image collections, which takes an ee.Filter()
as its argument. Explore the Docstab of the Code
Editor to learn more about these methods. The argument to filterBounds()
is the point you digitized and the arguments to filterDate()
are two dates,
expressed as strings.
Note that you can print()
the filtered collections. You can't print more than
5000 things at once, so you couldn't, for example, print the entire l8
collection. After executing the print()
method, you can inspect the
printed collections in the console. Note that when you expand the ImageCollection
using the zippy
(), then expand the
list of
features
, you will see a list of images, each of which also can be
expanded and inspected. This is one way to discover the ID of an individual image. Another,
more programmatic way to get individual images for analysis is to sort the collection
in order to get the most recent, oldest, or optimal image relative to some metadata
property. For example, by inspecting the image objects in the printed image collections,
you may have observed a metadata property called CLOUD_COVER
. You can use
that property to get the least cloudy image in 2015 in your area of interest:
Code Editor (JavaScript)
// This will sort from least to most cloudy. var sorted = temporalFiltered . sort ( 'CLOUD_COVER' ); // Get the first (least cloudy) image. var scene = sorted . first ();

