Lab 2 - Hello LandSat!

Objective: Learn to visualize satellite imagery bands and create RGB composites.

Introduction

Satellite images are at the heart of Google Earth Engine's power. This lab teaches you how to inspect and visualize data stored in image bands. We first visualize individual bands as separate map layers and then explore a method to visualize three different bands in a single composite layer. We compare different kinds of composites for satellite bands that measure electromagnetic radiation in the visible and non-visible spectrum.

Lab Instructions

  1. Part 1 - Accessing an Image

    To begin, you will construct an image with the Code Editor. Open up https://code.earthengine.google.com/

    var first_image = ee.Image('LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606');

    Hit the run button, and you will not see anything happen, but you have just loaded the Landsat image into memory.

    You can explore the image in several ways. To start, you can retrieve metadata (descriptive data about the image) by printing the image to the Code Editor's Console panel. Now in the next line of code, print to console first_image the way you did with Hello world.

    print(first_image);

    You may need to click the expander arrows in the Console panel to show the information. You should be able to read that this image consists of 19 different bands. For each band, the metadata lists four properties, but for now, let's simply note that the first property is a name or label for the band enclosed in quotation marks. For example, the name of the first band is "SR_B1".

    Console output showing image metadata
    Image metadata displayed in the Console

    A satellite sensor like Landsat 5 measures the magnitude of radiation in different portions of the electromagnetic spectrum. The first six bands in our image ("SR_B1" through "SR_B7") contain measurements for six different portions of the spectrum. The first three bands measure visible portions of the spectrum or quantities of blue, green, and red light. The other three bands measure infrared portions of the spectrum that are not visible to the human eye.

    An image band is an example of a raster data model, storing geographic data in a two-dimensional grid of pixels or picture elements. In remote sensing, the value stored by each pixel is often called a Digital Number or DN. Depending on the sensor, the pixel value or DN can represent a range of possible data values.

  2. Step 2 - Visualizing Single Bands of Imagery

    Now let's add one of the bands to the map as a layer so that we can see it. We will use the Map.addLayer method: Documentation

    Map.addLayer(first_image); // dataset to display

    Push the run button. Just adding the map doesn't center the map on the image. The image is added, but you may have to zoom out and zoom in to find it.

    A better way to center the map on the image is to use Map.setCenter. Add the following line of code to your script: Documentation

    Map.setCenter(122, 32, 7);

    Now when you hit the run button, the map will generate over the image.

    The image that is presented is not very useful yet as it is not visualized. Read the following documentation to learn how you can change the parameters of this method to visualize the image.

    Now we will play with the visualization parameters to make the image look better. If you look in the Layer panel on the map, you will see the layer you just added shown as Layer1. Hovering the mouse next to it you will see a gearbox. Click on the gearbox and put in the following settings.

    Visualization parameter settings
    Setting visualization parameters

    When hitting the apply button, you will see the image looks much better. We did not code these into your setting, but you can with the addLayer method and these four important components:

    1. first_image: This is the dataset to display on the map.
    2. bands: These are the particular bands from the dataset to display on the map.
    3. min, max: These represent the lower and upper bounds of values to display. By default, the minimum value provided (8000) is mapped to black, and the maximum value provided (17000) is mapped to white.
    4. 'Band 1': This is a label for the map layer to display in the Layer Manager.

    This translates to code like this:

    Map.addLayer(
        first_image,
        {
            bands: ['SR_B1'],
            min: 8000,
            max: 17000
        },
        'Band 1'
    );

    Now we will repeat this and add three different bands to compare:

    Map.addLayer(
        first_image,
        {
            bands: ['SR_B1'],
            min: 8000,
            max: 17000
        },
        'Band 1'
    );
    
    Map.addLayer(
        first_image,
        {
            bands: ['SR_B2'],
            min: 8000,
            max: 17000
        },
        'Band 2'
    );
    
    Map.addLayer(
        first_image,
        {
            bands: ['SR_B3'],
            min: 8000,
            max: 17000
        },
        'Band 3'
    );

    Examine the three layers. Try out the inspector tool. Click on areas around the map and compare the band values. Using the controls in the Layers manager, explore these layers and examine how the pixel values in each band differ.

    Question: Which do you think is blue, green, and red?

  3. Step 3 - True-Color Composites

    We can use color to compare these visual differences in the pixel values of each band layer all at once as an RGB composite. This method uses the three primary colors (red, green, and blue) to display each pixel's values across three bands.

    Map.addLayer(
        first_image,
        {
            bands: ['SR_B3', 'SR_B2', 'SR_B1'],
            min: 8000,
            max: 17000
        },
        'Natural Color');

    Run the script. The result looks like the world we see, and is referred to as a natural-color composite, because it naturally pairs the spectral ranges of the image bands to display colors. Also called a true-color composite, this image shows the red spectral band with shades of red, the green band with shades of green, and the blue band with shades of blue.

    True color composite result
    True-color composite of Landsat imagery

    A Landsat image contains many more bands than just the three true-color bands. We can make RGB composites to show combinations of any bands—even those outside what the human eye can see. For example, band 4 represents the near-infrared band, just outside the range of human vision.

    Map.addLayer(
        first_image,
        {
            bands: ['SR_B4', 'SR_B3', 'SR_B2'],
            min: 8000,
            max: 17000
        },
        'False Color');

    The display colors in this false-color composite no longer pair naturally with the bands. This particular example, more precisely referred to as a color-infrared composite, is a scene we cannot observe with our eyes but learn to read and interpret.

    False color composite result
    False-color (color-infrared) composite

    Notice how the land appears bright red. This is because the pixel value of the first band (which is drawing the near-infrared brightness) is much higher relative to the pixel value of the other two bands. You can check this by using the Inspector tool.

    In total, the false-color composite provides more contrast than the true-color image for understanding differences across the scene.

📧 Lab Submission

Save your work and submit the URL of your Code.

Submit lab via email.

Subject: Lab 2 - Hello LandSat - [Your Name]

Include in your email:

  • The shareable link to your GEE script
  • Screenshots of both true-color and false-color composites
  • Your answer to: Which bands are blue, green, and red?