Lab 15 - Visualizing SRTM Data

Objective: Bring SRTM elevation data into GEE and apply color ramps and hillshade visualization.

What You'll Learn

  • Load Digital Elevation Model (DEM) data using the Image constructor
  • Configure map center and zoom level
  • Customize visualization with min/max values
  • Apply color palettes to single-band imagery
  • Generate hillshade from elevation data

Building On Previous Learning

This lab introduces terrain data visualization. You'll use Map.addLayer() with more advanced visualization parameters than in previous labs.

Why This Matters

Elevation data is fundamental for many applications:

  • Hydrology: Understanding water flow and drainage basins
  • Geomorphology: Analyzing landforms and terrain processes
  • Urban planning: Identifying flood-prone or steep areas
  • Ecology: Understanding species distribution with elevation
  • Visualization: Creating compelling 3D-like terrain maps

Before You Start

  • Prerequisites: Complete Lab 14 and skim the terrain visualization tips from the module.
  • Estimated time: 60 minutes
  • Materials: Earth Engine account, SRTM dataset ID, and a list of color palettes to test.

Key Terms

SRTM (Shuttle Radar Topography Mission)
A NASA mission that produced near-global elevation data at ~30m and ~90m resolution.
DEM (Digital Elevation Model)
A raster representation of ground surface topography, with each pixel containing an elevation value.
Hillshade
A visualization technique that simulates shadows from a light source to show terrain relief.
Color Palette/Ramp
A sequence of colors mapped to data values for visualization.

Step 1: Load the SRTM Image

Use the Image constructor to load SRTM elevation data:

  1. Search for 'elevation' in the data catalog
  2. Click 'SRTM Digital Elevation Data Version 4'
  3. Click Import and rename the variable to 'srtm'
// Load SRTM elevation data
var srtm = ee.Image("USGS/SRTMGL1_003");

// Print to see the band information
print('SRTM:', srtm);

About SRTM: The dataset has one band called 'elevation' containing height values in meters above sea level.

Step 2: Configure the Map View

Use Map.setCenter() to focus on an interesting area:

// Center on the Grand Canyon
Map.setCenter(-112.8598, 36.2841, 9);
Argument Description Example
Longitude East-West position (decimal degrees) -112.8598
Latitude North-South position (decimal degrees) 36.2841
Zoom Map scale (0=world, 20=building) 9

Step 3: Display with Default Visualization

// Display with default grayscale
Map.addLayer(srtm, {}, 'SRTM Default');

Notice the default grayscale isn't very informative - we need to customize it!

Step 4: Customize Min/Max Values

Use the Inspector tool to explore elevation values, then set appropriate min/max:

// Set min/max for better contrast
Map.addLayer(srtm, {min: 0, max: 3000}, 'Custom Range');

Try It!

Click around the map using the Inspector tool. What are the lowest and highest elevations in your area?

Step 5: Apply a Color Palette

Add a color palette to make elevation more visually informative:

// Apply a terrain color palette
Map.addLayer(srtm, {
    min: 0, 
    max: 3000, 
    palette: ['blue', 'green', 'yellow', 'orange', 'red']
}, 'Elevation Colors');

// Or use a more natural terrain palette
Map.addLayer(srtm, {
    min: 0, 
    max: 3000, 
    palette: ['#0000FF', '#00FF00', '#FFFF00', '#FF8000', '#FF0000', '#FFFFFF']
}, 'Terrain Palette');

Step 6: Create a Hillshade

Use ee.Terrain.hillshade() to add 3D-like shading:

// Create hillshade
var hills = ee.Terrain.hillshade(srtm, 270, 45);

// Display hillshade
Map.addLayer(hills, {min: 0, max: 255}, 'Hillshade');
Parameter Description Value
Azimuth Light direction (degrees from north) 270 (from west)
Elevation Light angle above horizon 45 degrees

Complete Code

// Lab 15 - Visualizing SRTM Data

// Load SRTM elevation data
var srtm = ee.Image("USGS/SRTMGL1_003");

// Center on Grand Canyon
Map.setCenter(-112.8598, 36.2841, 9);

// Display with default visualization
Map.addLayer(srtm, {}, 'SRTM Default');

// Display with custom min/max
Map.addLayer(srtm, {min: 0, max: 3000}, 'Custom Range');

// Display with color palette
Map.addLayer(srtm, {
    min: 0, 
    max: 3000, 
    palette: ['blue', 'green', 'yellow', 'orange', 'red']
}, 'Elevation Colors');

// Create and display hillshade
var hills = ee.Terrain.hillshade(srtm, 270, 45);
Map.addLayer(hills, {min: 0, max: 255}, 'Hillshade');

Check Your Understanding

  1. What does the SRTM elevation band represent? What are the units?
  2. Why is setting min/max important for visualization?
  3. What azimuth angle would you use for light from the south?
  4. How could you combine hillshade with the color elevation layer?

Troubleshooting

Problem: Image appears all white or all black

Solution: Your min/max values don't match the data range. Use the Inspector to find actual values in your area.

Problem: Color palette doesn't look smooth

Solution: Add more color stops to your palette for smoother gradients (e.g., 6-8 colors instead of 3).

Problem: Hillshade looks flat in some areas

Solution: Flat terrain will always appear flat in hillshade. Try different azimuth angles to highlight subtle features.

Pro Tips

  • Combine layers: Blend hillshade with elevation colors for a professional look
  • Use hexadecimal colors: For precise control, use hex codes like '#FF5733'
  • Explore other DEMs: Try ALOS, Copernicus, or NASADEM for different areas/resolutions
  • Derive other products: Use ee.Terrain for slope, aspect, and curvature

Key Takeaways

  • SRTM provides near-global elevation data at ~30m resolution
  • Customize visualization with min, max, and palette parameters
  • Hillshade adds 3D-like appearance to terrain maps
  • The ee.Terrain module provides terrain analysis functions

📋 Lab Submission

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

Submit:

A shareable URL to your GEE code that includes:

  1. SRTM data loaded and displayed
  2. Custom color palette applied
  3. Hillshade layer created
  4. Comments explaining your visualization choices