How to Download Landsat Imagery from Google Earth Engine

How to Download Landsat Imagery from Google Earth Engine

A Practical Guide

July 21, 20243 min read

Introduction

Google Earth Engine (GEE) is a cloud-based platform that provides access to a vast catalog of satellite imagery and geospatial data. This platform enables users to perform complex earth science analysis at scale. 

Why Use Google Earth Engine?

Google Earth Engine offers several advantages for accessing and analyzing Landsat Imagery:

  • Massive Dataset: GEE hosts over 30 years of historical imagery and datasets, amounting to over eighty petabytes of data readily available for analysis.

  • Cloud-Based Processing: Because it runs on the cloud, GEE enables faster processing times, regardless of data volume.

  • Seamless Data Acquisition: Easily access and process imagery for your area of interest without downloading multiple scenes, which requires preprocessing steps like manual mosaicking and clipping.

Getting Started

You will need to sign up to access the Google Earth Engine Code Editor. If you want to create an account, this article will guide you on how to do that.

If you have a specific area of interest, you can import the shapefile before we get started.

Importing Your Area of Interest (AOI):

  • In the 'Assets' tab in GEE, click 'New'.

  • Select the appropriate file format (e.g., Shapefile, GeoTIFF) to import your AOI.

  • Upload your AOI and rename the imported asset to 'AOI' for convenience.

Now that we have imported our AOI, let's get started!

Step 1: Load Landsat Imagery

The first step is to load the Landsat imagery you want to download.

  • In the GEE code editor, search for your desired Landsat collection (e.g., Landsat 9).

  • You can either copy the collection snippet or import the imagery directly

  • After loading the imagery, filter it by date using the yyyy/mm/dd format (e.g., “start date" , “end date”) and then filter by the desired cloud cover percentage (preferably 10% and below).

//Load Landsat 9 Imagery
var image = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
    .filterDate('2013-01-01', '2014-12-31')
    .filter(ee.Filter.lt('CLOUD_COVER', 10));

Step 2: Apply Scaling Factors

// Apply scaling factors
function applyScaleFactors(image) {
  var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
  var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0);
  return image.addBands(opticalBands, null, true)
              .addBands(thermalBands, null, true);
  • Apply the scaling factors to the filtered image

    //Apply the scale Factors to Image
    image = image.map(applyScaleFactors)
                  .median()
                  .clip(AOI);

Step 3: Set Visualization Parameters

  • Now that the imagery is loaded and scaled, you need to set how you want to visualize it. Typically, True Color Visualization is used: Bands 4,3,2 for Landsat 8 and 9, and Bands 3,2,1 for Landsat 7.

// Define visualization parameters for True Color imagery (bands 4, 3, and 2)
var visualization = {
  bands: ['SR_B4', 'SR_B3', 'SR_B2'],
  min: 0.0,
  max: 0.3,
};

Step 4: Add the Processed Image to the Layer with the specified Visualization

  • Use the Map.addLayer function to add the processed image to the map with the specified visualization parameters:

// Add the processed image to the map with the specified visualization
Map.addLayer(image, visualization, 'Ogun_L8_2013');
  • To focus on your area of interest, center the map on Your AOI using the Map.centerObject function.Adjust the centering as necessary until your area of interest is visible.

    Map.centerObject(AOI, 7);

Step 5: Export Image to Drive

Export the processed image to your Google Drive:

//Export the image
Export.image.toDrive({
  image: image,
  description: 'Ogun_L8_2013',
  scale: 30,
  region: AOI
});
  • Click on ‘Run’ and your image will appear on the ‘Tasks’ tab as an unsubmitted task.

  • Click ‘Run’ under ‘Tasks’ to export the image to your drive.

  • Once fully exported, you will see a check symbol beside it. You can then download your image from your drive.

Congratulations! You have successfully downloaded Landsat 9 imagery using Google Earth Engine.

Pro Tips:

  • Always add comments to each step in the code editor for reference and easy understanding.

  • Use double forward slashes (//) to write comments.

Things to Note:

  • JavaScript, the language we used for writing the codes in this article, is case-sensitive, so be careful with your keywords and functions, to ensure consistency.

  • Functions written correctly should be displayed in a different font color, as well as comments.

Cloud ComputingGEEGoogle Earth EngineLandsat

Join the community!

We're a place where geospatial professionals showcase their works and discover opportunities.

More from Faith Abiala

Explore More Articles