0% found this document useful (0 votes)
21 views8 pages

GEE 3622 Lab 3

Uploaded by

zimbadaniel37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views8 pages

GEE 3622 Lab 3

Uploaded by

zimbadaniel37
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Department of Geomatic Engineering

GEE 3622: Principles of Data Acquisition and Processing


Lab 3 – Introduction to Google Earth Engine
DUE – 19th September 2024

Prerequisites: Completing this lab exercise requires using the Google Chrome browser and a Google
Earth Engine account. If you have not yet signed up - please do so now in a new tab by opening the
following link:
https://code.earthengine.google.com/register

Once registered you can access the Earth Engine environment here: https://code.earthengine.google.com

Objective: The objective of this lab is to give you an introduction to the Google Earth Engine processing
environment. By the end of this exercise, you will be able to search, find and visualise a broad range of
remotely sensed datasets. We will start with single-band imagery - elevation data from the SRTM
mission.

The Earth Engine code editor

Figure 1 The Earth Engine environment


1. Editor Panel
• The Editor Panel is where you write and edit your Javascript code
2. Right Panel
• Console tab for printing output.
• Inspector tab for querying map results.
• Tasks tab for managing long-running tasks.
3. Left Panel
• Scripts tab for managing your programming scripts.
• Docs tab for accessing documentation of Earth Engine objects and methods
• Assets tab for managing assets that you upload.
4. Interactive Map
• For visualizing map layer output
5. Search Bar
• For finding datasets and places of interest
• Search for Landsat 8 collection 2 data and look at the different bands available
6. Help Menu
• User guide reference documentation
• Help forum Google group for discussing Earth Engine
• Shortcuts Keyboard shortcuts for the Code Editor
• Feature Tour overview of the Code Editor
• Feedback for sending feedback on the Code Editor

Getting started with images


• Navigate to UNZA and zoom in using the mouse wheel.
• Search for "elevation" and click on the SRTM Digital Elevation Data 30m result to show the dataset
description.
• View the information on the dataset, and then click on Import, which moves the variable to the
Imports section at the top of your script.

Figure 2 View elevation data source and impor


• Rename the default variable name "image" to be "srtm".

Figure 3 •Rename the default variable name "image" to be "srtm”

• Add the image to the console by running the code below:


print(srtm);

• Browse through the information that was printed to the console. Open the "bands"
section to show the one band named "elevation". Note that all this same information is automatically
available for all variables in the Imports section.
• Use the Map.addLayer() method to add the image to the interactive map. We will start simple,
without using any of the optional parameters.
Map.addLayer(srtm);

The displayed map will look pretty flat grey, because the default visualization parameters map the full 16-
bit range of the data onto the black-white range, but the elevation range is much smaller than that in any
particular location. We'll fix it in a moment.

Figure 4 Add the image to the interactive map

• Select the Inspector tab. Then click on a few points on the map to get a feel for the
elevation range in this area.
• Now you can set some more appropriate visualization parameters by adjusting the code as follows
(units are in meters above sea level):
Map.addLayer(srtm, {min: 1200, max: 1340});
Figure 5 SRTM with more appropriate min and max values

• You will now be able to see variation in elevation range with low values in black and highest points
in white. Layers added to the map will have default names like "Layer 1", "Layer 2", etc. To improve
the readability, we can give each layer a human-readable name, by adding a title with the syntax in
the following code. Don't forget to click run.
Map.addLayer(srtm, {min: 1200, max: 1340}, 'Elevation above sea level');

Figure 6 Image with human readable title


Commenting, saving and sharing your scripts
• Now the last step for today is to save your code, however before doing that it is good practice adding
some comment lines to your code reminding you of what you did and why. We add these with two
forward slashes // :
// Print data details to console
print(srtm);
// Add the SRTM data to the interactive map
Map.addLayer(srtm)
// Add the data again, but with restricted value ranges for better visualisation
Map.addLayer(srtm, {min: 1200, max: 1370})
// Add the data again, with value ranges, and a useful title for the Layer tab
Map.addLayer(srtm, {min: 1200, max: 1370}, 'Elevation above sea level);

Figure 7 saving scripts

11. The next step is then to save you script by clicking "Save". It will be saved in
private repository, and will be accessible the next time you log in to Earth Engine.
12. If you would like to experiment with different colour combinations, you can play with
colour palettes as per the example below:
Map.addLayer(srtm, {min: 1200, max: 1350, palette: ['blue', 'yellow', 'red']}, 'Elevatic

13. For better visualisation we can create a hillshade view of the elevation data.
Remember you can use the Layer transparency options to create draped images for
colourised hillshades.
var hillshade = ee.Terrain.hillshade (srtm);
=
Map.addLayer(hillshade, {min: 150, max:255}, 'Hillshade');

Figure 8 Hillshade view with transparency adjusted (Hillshade draped on elevation)

TASKS
1. Import the Lusaka district shapefile as an asset in the EE environment
2. Import the shapefile into the editor
3. Create a variable called LSK_geometry by running the following code:
Var LSK_geometry = Lusaka_District.geometry();
4. Clip the SRTM using the LSK_geometry by running the following code:
Var clipped = SRTM.clip(LSK_geometry)
5. Use the clipped SRTM to repeat the tasks done on the original SRTM

Deliverables:
1. Lab Report – Concise and clear
2. Link to the repository

You might also like