STARTERS
Landsat
Earth Engine provides a number of different Landsat products as cloud assets.
The starter scripts on this page will help you quickly find and process collection 2, tier 1, level 2, surface reflectance data for a place and time of interest.
Since that was a mouthful, let’s define some key terms first.
key terms
collections
There have been two major reprocessing efforts by USGS to improve data quality. Collection 2 is the most recent and has the best geolocation accuracy which improves time series analyses.
tiers
Within a collection, Tier 1 data have the highest radiometric and positional quality. USGS recommends using Tier 1 data for all time-series analysis.
levels
The level of data processing applied to products.
-
Level-1 includes processing to improve locational accuracy of data.
-
Level-2 products are built from Level 1, but also provide atmospheric correction to create surface reflectance and surface temperature products. Level-2 science products also include spectral indices derived from surface reflectance products.
-
Level-3 products are built from Level-2 products and include Analysis Ready Data (ARD), including Fractional Snow Covered Area and Burned Area, and Scene-based Inputs, including Provisional Actual Evapotranspiration.
orbit
This video visualizes the path of Landsat 8 around the globe. Please note that some details about satellite orbits differ between Landsat missions.
spectral bands
The chart below compares the bands of each mission with respect to spectral and spatial resolution.
mother of landsat
Please read Virginia Tower Norwood’s biography.
prereqs
To thoughtfully use the starter scripts below, you should be able to answer these questions:
- what is surface reflectance and how does this differ from other Landsat products available through Earth Engine catalog?
- what is the mission duration (start and end of image collection)?
- what is the recurrence time of each scene (how may days between images)?
- how does the satellite orbit affect the time difference between neighboring scenes?
- what time of day is the scene captured as an image?
- what portion of the EM spectrum does each band measure?
- what is the spatial resolution of each band?
snapshots
These scripts will help you get started making snapshots from Landsat collections.
Landsat 5
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Title: starter_L5.js
// Author: Jeff Howarth
// Last edited: 11/4/2024
//
// Starter for Landsat 5 collection.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var geo = require("users/jhowarth/eePatterns:modules/geo.js");
print("geo methods dictionary", geo.help); // Prints dictionary of all tools in module.
print("geo palettes", geo.iPalettes); // Prints dictionary of all palettes in module.
// ------------------------------------------------------------------------
// Define your point or area of interest with geometry tools.
// ------------------------------------------------------------------------
var geometry =
ee.Geometry.Point([37.34715255366928, -3.0521293499524087]);
Map.centerObject(geometry, 8);
// ------------------------------------------------------------------------
// Filter and flatten image collection.
// ------------------------------------------------------------------------
var output = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2')
.filterBounds(geometry)
// .filter(ee.Filter.calendarRange(1995, 1995, 'year'))
.filter(ee.Filter.calendarRange(1, 3, 'month'))
// .filter(ee.Filter.calendarRange(1, 1, 'day_of_year'))
.filter(ee.Filter.lt('CLOUD_COVER', 20))
.map(geo.icLandsat.scale_L5)
.map(geo.icLandsat.cloudMask_L5)
.median()
;
print("Landsat 5 image", output);
// ------------------------------------------------------------------------
// Display layer on Map.
// ------------------------------------------------------------------------
var viz = {
bands: ['SR_B3', 'SR_B2', 'SR_B1'],
min: [0.0, 0.0, 0.0],
max: [0.3, 0.3, 0.3],
};
Map.addLayer(output, viz, 'Landsat 5 image');
// ------------------------------------------------------------------------
// Chart histogram for a selected Image band.
// ------------------------------------------------------------------------
// Select a band in viz dictinary to chart.
var select_band = output.select(viz.bands[0]);
// Get AOI from map extent.
var aoi = geo.uiMap.getAOIfromMapExtent();
// Make and print histogram.
var histogram = geo.iCart.iHistogram(select_band, 30, aoi);
print("Histogram of selected band", histogram);
Landsat 7
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Title: starter_L7.js
// Author: Jeff Howarth
// Last edited: 11/4/2024
//
// Starter for Landsat 7 collection.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var geo = require("users/jhowarth/eePatterns:modules/geo.js");
print("geo methods dictionary", geo.help); // Prints dictionary of all tools in module.
print("geo palettes", geo.iPalettes); // Prints dictionary of all palettes in module.
// ------------------------------------------------------------------------
// Define your point or area of interest with geometry tools.
// ------------------------------------------------------------------------
var geometry =
ee.Geometry.Point([37.34715255366928, -3.0521293499524087]);
Map.centerObject(geometry, 8);
// ------------------------------------------------------------------------
// Filter and flatten image collection.
// ------------------------------------------------------------------------
var output = ee.ImageCollection('LANDSAT/LE07/C02/T1_L2')
.filterBounds(geometry)
// .filter(ee.Filter.calendarRange(2000, 2000, 'year')) // January 1999βApril 2022
.filter(ee.Filter.calendarRange(1, 3, 'month'))
// .filter(ee.Filter.calendarRange(1, 1, 'day_of_year'))
// .filter(ee.Filter.lt('CLOUD_COVER', 20))
.map(geo.icLandsat.scale_L7)
.map(geo.icLandsat.cloudMask_L7)
.median()
;
print("Landsat 7 image", output);
// ------------------------------------------------------------------------
// Display as layer on Map.
// ------------------------------------------------------------------------
var viz = {
bands: ['SR_B3', 'SR_B2', 'SR_B1'],
min: [0.0, 0.0, 0.0],
max: [0.3, 0.3, 0.3]
};
Map.addLayer(output, viz, 'Landsat 7 image');
// ------------------------------------------------------------------------
// Chart histogram for a selected Image band.
// ------------------------------------------------------------------------
// Select a band in viz dictinary to chart.
var select_band = output.select(viz.bands[0]);
// Get AOI from map extent.
var aoi = geo.uiMap.getAOIfromMapExtent();
// Make and print histogram.
var histogram = geo.iCart.iHistogram(select_band, 30, aoi);
print("Histogram of selected band", histogram);
Landsat 8
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Title: starter_L8.js
// Author: Jeff Howarth
// Last edited: 11/4/2024
//
// Starter for Landsat 8 collection.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var geo = require("users/jhowarth/eePatterns:modules/geo.js");
print("geo methods dictionary", geo.help); // Prints dictionary of all tools in module.
print("geo palettes", geo.iPalettes); // Prints dictionary of all palettes in module.
// ------------------------------------------------------------------------
// Define your point or area of interest with geometry tools.
// ------------------------------------------------------------------------
var geometry =
ee.Geometry.Point([37.34715255366928, -3.0521293499524087]);
Map.centerObject(geometry, 8);
// ----------------------------------------------------------------------
// Filter and flatten image collection.
// ----------------------------------------------------------------------
var output = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
.filterBounds(geometry)
// .filter(ee.Filter.calendarRange(2015, 2015, 'year'))
.filter(ee.Filter.calendarRange(1, 3, 'month'))
// .filter(ee.Filter.calendarRange(1, 1, 'day_of_year'))
// .filter(ee.Filter.lt('CLOUD_COVER',20))
.map(geo.icLandsat.scale_L8)
.map(geo.icLandsat.cloudMask_L8)
.median()
;
print("Landsat 8 image", output);
// ----------------------------------------------------------------------
// Display as layer on Map.
// ----------------------------------------------------------------------
var viz = {
bands: ['SR_B4', 'SR_B3', 'SR_B2'],
min: [0.0, 0.0, 0.0],
max: [0.25, 0.25, 0.25],
};
Map.addLayer(output, viz, 'Landsat 8 image');
// ------------------------------------------------------------------------
// Chart histogram for a selected Image band.
// ------------------------------------------------------------------------
// Select a band in viz dictinary to chart.
var select_band = output.select(viz.bands[0]);
// Get AOI from map extent.
var aoi = geo.uiMap.getAOIfromMapExtent();
// Make and print histogram.
var histogram = geo.iCart.iHistogram(select_band, 30, aoi);
print("Histogram of selected band", histogram);
Landsat 9
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Title: starter_L9.js
// Author: Jeff Howarth
// Last edited: 11/4/2024
//
// Starter for Landsat 9 collection.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var geo = require("users/jhowarth/eePatterns:modules/geo.js");
print("geo methods dictionary", geo.help); // Prints dictionary of all tools in module.
print("geo palettes", geo.iPalettes); // Prints dictionary of all palettes in module.
// ------------------------------------------------------------------------
// Define your point or area of interest with geometry tools.
// ------------------------------------------------------------------------
var geometry =
ee.Geometry.Point([37.34715255366928, -3.0521293499524087]);
Map.centerObject(geometry, 8);
// ----------------------------------------------------------------------
// Filter and flatten image collection.
// ----------------------------------------------------------------------
var output = ee.ImageCollection("LANDSAT/LC09/C02/T1_L2")
.filterBounds(geometry)
// .filter(ee.Filter.calendarRange(2022, 2022, 'year'))
.filter(ee.Filter.calendarRange(1, 3, 'month'))
// .filter(ee.Filter.calendarRange(1, 1, 'day_of_year'))
// .filter(ee.Filter.lt('CLOUD_COVER',20))
.map(geo.icLandsat.scale_L9)
.map(geo.icLandsat.cloudMask_L9)
.median()
;
print("Landsat 9 image", output);
// ----------------------------------------------------------------------
// Display image as layer on Map.
// ----------------------------------------------------------------------
var viz = {
bands: ['SR_B4', 'SR_B3', 'SR_B2'],
min: [0.0, 0.0, 0.0],
max: [0.25, 0.25, 0.25],
};
Map.addLayer(output, viz, 'Landsat 9 image');
// ------------------------------------------------------------------------
// Chart histogram for a selected Image band.
// ------------------------------------------------------------------------
// Select a band in viz dictinary to chart.
var select_band = output.select(viz.bands[0]);
// Get AOI from map extent.
var aoi = geo.uiMap.getAOIfromMapExtent();
// Make and print histogram.
var histogram = geo.iCart.iHistogram(select_band, 30, aoi);
print("Histogram of selected band", histogram);
Land Surface Temperature
Sofia Ermida wrote and shared a super helpful module that makes it relatively easy to compute land surface temperature (LST) from Landsat collections. The script below outlines a basic pattern for using her module.
// Load module to compute LST from Landsat.
var LandsatLST = require('users/sofiaermida/landsat_smw_lst:modules/Landsat_LST.js');
// Define arguments for LST module.
var date_start = '2020-07-01'; // Filter collection by time start.
var date_end = '2024-09-01'; // Filter collection by time end.
var region = aoi; // Filter collection by location.
var use_ndvi = true; // Use NDVI in computation (true or false)
// Compute LST from Landsat 9.
var L9 = LandsatLST
.collection
(
'L9', // Landsat mission - note this is a string 'L9'.
date_start,
date_end,
region,
use_ndvi
)
;
Note that you call the Landsat mission with a string:
"L9"
calls Landsat 9"L8"
calls Landsat 8"L7"
calls Landsat 7"L5"
calls Landsat 5
Sofia’s script pulls data from both surface reflectance and top of atmosphere Landsat collections, so behind the scenes the string that you enter as an argument points to a set of instructions for working with that mission data that the module carries out. The underlying code is public-facing on her github site if you would like to understand in detail how it works. You can also read her article on the module if you would like to learn more.
This work is licensed under CC BY-NC-SA 4.0