Lab 15 - Visualizing SRTM Data

Lab 15 Lecture - Spring 2023 - Visualizing SRTMs

Objective: In this lab, you will bring an SRTM into Google Earth Engine and apply a color ramp. You will turn in a URL of your final code from Earth Engine.

1 - Image Constructor

First, you will need to instantiate an image with the Image constructor.  The image constructorLinks to an external site. ee.Image() gives you access to the raster datasets stored on GEE, and is made using a string ID of an image in the Earth Engine data catalog. 

Search the Earth Engine data catalog using the search tool at the top of the Code Editor to discover an image ID. 

2 - Configuring the Map

The Map.setCenter() method centers the map view at given coordinates with the given zoom level. It takes three arguments:

For example, the following code centers the map on the Grand Canyon. Put this code in the code editor of GEE:

// Zoom to a location.
Map.setCenter(-112.8598, 36.2841, 9); // Center on the Grand Canyon.

The Result of the center

3- Adding a layer to the Map

Now use the Mapobject's addLayer() method to add an image to the map display in the Code Editor.

// Display the image on the map.
Map.addLayer(srtm); //SRTM is the name of my var for the image.

4 - Push Run

Push run, and your screen should look like this:

results from the code

 

5 - Customizing layer visualization

Notice that the image comes in with a default grayscale.  It is not very easy to visualize the elevation through this. So we will customize the visualization. 

6 - Working with color

To display a single band using a color palette, add a palette property to the visParams object:

Map.addLayer(srtm, {min: 0, max: 3000, palette: ['blue', 'green', 'red']},
   
'custom palette');

results

7 - Making a Hillshade

To display a hillshade we will use some algorithms that are built into the GEE library.  

The ee.Terrain.hillshade function computes a simple hillshade from a digital elevation model (DEM). It takes four arguments:

//add a hillshade
var hills = ee.Terrain.hillshade(srtm, 270, 45)

//add hillshade to map
Map.addLayer(hills, {min: 0, max: 500},'Hillshade')

hillshade results

8 - Share the link

Push the Get Link button and submit the link to your code. Be sure to comment you code. 

Lab Submission

Submit lab via email.

Subject: Lab 15 - Visualizing SRTM Data - [Your Name]