1 Introduction

In this module, we will discuss the following concepts:

  1. Defining the main data types in Google Earth Engine and how to use them.
  2. How to explore datasets and restrict outputs for a specific study site.
  3. How to visualize differences in photosynthetic activity between pre and post-fire landscapes.

2 Background

Remote sensing can be a powerful tool for ecologists to understand study systems or areas of interest at larger spatial scales. Remote sensing tools alone are no substitute for fieldwork or the physical collection of samples but are useful for describing the spatial and temporal landscape characteristics that develop our understanding of ecological processes.

There are numerous data sources available to download remotely sensed data products, but collecting these datasets has long been a tedious and time-consuming task. Google Earth Engine (GEE) eliminates the downloading, preprocessing, and heavy computational environment that is traditionally involved with using remotely sensed data. While optimized for ‘big data’, GEE is a flexible and transparent platform that can address a wide variety of research areas from forestry to drought monitoring to crop mapping.

In this module, you will begin to explore GEE’s functionality by using data from the National Agriculture Imagery Program (NAIP). NAIP data consists of aerial imagery acquired during agricultural growing seasons in the continental United States. Depending on the given location and time frame, NAIP imagery is collected in four bands: blue, green, red, and near infrared. More information about NAIP is available here.

3 Getting Started With Google Earth Engine

Google Earth Engine is a web-based platform that provides access to large libraries of geospatial data, typically in raster format, and is a distributed computing environment on Google servers, allowing you to rapidly move into asking your questions and developing testable workflows. However, GEE does require registration via a Google account. So before continuing this module, you will need to make an account/register. You can sign up and read more at GEE sign up page. Once you are signed up, navigate to code.earthengine.google.com and then continue with the module.

3.2 A Brief Note on JavaScript

All scripts in GEE’s code editor are written in JavaScript (JS). If you are not familiar with this programming language, fear not! There are a tremendous number of online resources for JS and GEE is actually fairly lenient about adhering to all the rules. Case in point, the standard protocol for JS is to end every command with a semicolon (;). However, if you happen to forget one, GEE will kindly remind you while (often) proceeding to run your code without a hitch. For more detailed information on the structure of JS and how to use it in GEE, click here.

3.3 Data Types: Rasters

The main data type utilized in GEE are rasters, covering local to global extents with imagery available from hundreds of satellite and aerial sources. To begin writing your first script, copy the code below into the script editor pane. This code requests the rasters from the NAIP imagery collection. However, requesting an image collection means that we have access to all the data in the collection–much more than we actually need. Using the filterDate() function to modify our original collection and limit number of images.

// Call in NAIP imagery as an image collection.
var NAIP = ee.ImageCollection("USDA/NAIP/DOQQ");

// Filter your dataset from the entire collection to the year of interest and extent.
var naip2011 = NAIP
  .filterDate("2011-01-01", "2011-12-31");


This code sets the framework for displaying or running an analysis on a section of the NAIP image collection, but that is it. Until we provide GEE an executable task, it will not do anything this information. What this means is when you hit run, nothing happens. It is a bit confusing, but think about GEE as being a lazy software program. You can give it instructions, but until you request a deliverable result, it will hold off on performing the instructions.

3.3.1 Viewing Raster Metadata

Now that we have loaded the NAIP imagery, we want to visualize it on the map. As NAIP is collected as a series of images, we need to create a multispectral image by defining which bands we want to use and visualize (more on bands in Module 2). We do this by setting visualization parameters and saving them as a variable. But before we can set our visualization parameters, we need to be able to reference the bands by name. To retrieve this information, type ‘NAIP’ into the search bar and click on ‘NAIP: National Agricultural Imagery Program’. The dataset information should be displayed in a popup like image below.

text

Viewing the NAIP metadata pop-up window after clicking the name of the dataset in the search bar.

3.3.2 Defining Visualization Parameters

Now that we know the names of our bands, we will add our imagery to our map viewer. True color images are useful for differentiating land cover types or physical objects on the landscape. False color imagery, which uses the near infrared band, can help to identify photosynthetically active areas on the landscape (in red). Because NAIP imagery is generally collected at high spatial resolution (1 meter), viewing the entirety of the United States would take very long time in GEE. Therefore, it is a good idea to focus on a smaller geographic extent.

Append the code below to your existing script and click run. Using the search bar, type and select Longmire, WA to zoom your map to Mount Rainier National Park. Your map viewer will look similar to the image below. Remember that you will have to open the ‘Layers’ tab in the map viewer and click the checkbox next to the layer you wish to activate.

// Define visualization parameters.
var visParamsFalse = {bands:['N', 'R', 'G']};
var visParamsTrue = {bands:['R', 'G', 'B']};

// Add 2011 imagery to the map with false color and true color composites
// here we specify either 'true; or 'false' in the third argument to toggle the layer to show automatically or to stay hidden when the code is exicuted. 
Map.addLayer(naip2011,visParamsFalse, "2011_false", true );
Map.addLayer(naip2011,visParamsTrue, "2011_true", false );

















A side by side comparison of true-color and false-color imagery for the 2011 NAIP collection in the map viewer over Mount Rainier in Washington State.

3.4 Data Types: Vector

Points, lines, and polygons are commonly classified as ‘vector’ objects in other GIS and remote sensing systems. In GEE, these data are referred to as geometries. Generally speaking, you will be responsible for either uploading or creating the geometry features you wish to use in GEE. You can manually create an area of interest (AOI) using either of the techniques described below.

3.4.1 Defining an Area of Interest

To explore data in a specific geographic region, we can manually create our AOI as a geometry feature in the GEE interface. This is as simple as selecting the geometry button (see the images below) and drawing a polygon that outlines your area of interest. Complete the geometry feature by clicking on the initial point.

When you complete the geometry feature by placing a point on the starting location, a new feature will appear at the top of the script editor with the default name geometry. This feature can now be used to limit the geographic scope of a GEE script. This is a useful function to get in the habit of using as the GEE default is to process the extent of the map viewer pane. The larger your extent, the longer your output will take to load!

Note: Clicking on the name allows you to re-title the geometry feature. To delete the feature, look at the top of your script and hover the mouse over the line of code that declares the geometry object. A trash can icon will appear just to the left of the line of code. Click the trash can to delete.


















Highlighting the polygon drawing tool (left) and the successfully imported geometry (right).

Another way to restrict the extent of the viewable imagery is to use a set of lat-long coordinates. In the image below, we have restricted our imagery to the extent of the High Park Fire using the filterBounds() function. To avoid having to zoom in every time we load our script, we can also use the centerObject() function to automatically center our Map Viewer pane on our imagery with predefined zoom level.

If you replace the code from section 3.3.2 with the following code and click run it should produce an image similar to the one shown below. Note that you do not need a semicolon after the filterDate() line because we are not yet finished modifying our NAIP collection.

// Enter the desired coordinates for the upper left and lower right corners of your study area.
// You can find the lat long coordinates by using the inspector.
var bounds = ee.Geometry.Rectangle([[-105.53,40.75],[-105.17,40.56]]);

// Filter your dataset from the entire collection to the year of interest and extent
// and add the filterBounds function, moving the semicolon to the end of the statement.
var naip2011 = NAIP
  .filterDate("2011-01-01", "2011-10-31")
  .filterBounds(bounds);

// Define visualization parameters.
var visParamsFalse = {bands:['N', 'R', 'G']};
var visParamsTrue = {bands:['R', 'G', 'B']};

// Add 2011 imagery to the map with false color and true color composites.
Map.addLayer(naip2011,visParamsFalse,"2011_false", false );
Map.addLayer(naip2011,visParamsTrue,"2011_true", false );

Map.centerObject(naip2011, 11);

bounded noco

The ee.geometry.Rectangle() object successfully bounding the extent of our NAIP imagery.

3.5 Putting Everything Together

Utilizing the NAIP data we have visualized in this module, we are well prepared to perform this introductory analysis using GEE. Appending an additional subset of NAIP data to our code, we can visually compare vegetation regrowth inside and outside the boundary of the High Park Fire. Running the following code we find that, while the true-color imagery is somewhat helpful, false-color imagery (shown below) allows us to easily distinguish between areas of low photosynthetic activity (higher burn severity) and area of relatively unchanged photosynthetic activity (low severity or unburned).

var naip2013 = NAIP
  .filterDate("2013-01-01", "2013-12-31")
  .filterBounds(bounds);

// add 2013 imagery to the map with false color and true color composites
Map.addLayer(naip2013, visParamsFalse, "2013_false", false );
Map.addLayer(naip2013, visParamsTrue, "2013_true", false );

2011 tc    2013 tc

2011 fc    2013 fc


True-color NAIP images from 2011 (upper left) and 2013 (upper right) compared to the false-color images from 2011 (bottom left) and 2013 (bottom right).

But the utility of NAIP imagery is not limited to large scale analyses. Zooming in to a smaller area of the High Park Fire (as shown below), we can see that assessments of burn extent can potentially be made at very small scales due to the high resolution of the dataset.



A closer look at the level of detail available via NAIP imagery. Individual trees are clearly visible in the 2011 image (top) with those that survived the fire still present in the 2013 image (bottom).

4 Conclusion

In this module, we introduced Google Earth Engine as a powerful tool for ecologists to utilize remote sensing data. We then defined the interactive elements of the Google Earth Engine user interface. Finally, we performed a simple exploration of NAIP imagery to see landscape-scale differences before and after the High Park Fire in northern Colorado.

5 Complete Code

// Call in NAIP imagery as an image collection.
var NAIP = ee.ImageCollection("USDA/NAIP/DOQQ");

// Enter the desired coordinates for the upper left and lower right corners of your study area.
var bounds = ee.Geometry.Rectangle([[-105.53,40.75],[-105.17,40.56]]);

// Filter your dataset from the entire collection to the year of interest and extent.
var naip2011 = NAIP
  .filterDate("2011-01-01", "2011-12-31")
  .filterBounds(bounds);
  
// Define visualization parameters.
var visParamsFalse = {bands:['N', 'R', 'G']};
var visParamsTrue = {bands:['R', 'G', 'B']};

// Add 2011 imagery to the map with false color and true color composites.
Map.addLayer(naip2011,visParamsFalse,"2011_false", false );
Map.addLayer(naip2011,visParamsTrue,"2011_true", false );

Map.centerObject(naip2011, 11);

// Add 2013 imagery to the map with false color and true color composites.
var naip2013 = NAIP
  .filterDate("2013-01-01", "2013-12-31")
  .filterBounds(bounds);

// Add 2013 imagery to the map with false color and true color composites.
Map.addLayer(naip2013,visParamsFalse,"2013_false", false );
Map.addLayer(naip2013,visParamsTrue,"2013_true", false );

6 Glossary & Abbreviations

AOI: area of interest

GEE: Google Earth Engine

JS: JavaScript

NAIP: National Agricultural Imagery Program