GEE Tutorials

Google Earth Engine Tutorial: Terrain Analysis with SRTM DEM

Credit: Youtube Channel “Terra Spatial, Comprehensive guide on performing terrain analysis including slope, aspect and elevation using SRTM DEM data”

You can see all the tutorials from here: Techgeo Academy.

Terrain Analysis with SRTM DEM in Google Earth Engine

Google Earth Engine (GEE) is a powerful platform for geospatial analysis, allowing users to process large-scale environmental datasets. One of the most common applications is terrain analysis using Digital Elevation Models (DEMs), such as the Shuttle Radar Topography Mission (SRTM) dataset. This tutorial walks you through loading, visualizing, and analyzing SRTM DEM data for topographic features like slope, aspect, and elevation.

Step 1: Load SRTM DEM Dataset

To begin, load the SRTM DEM dataset using GEE’s built-in dataset library. The SRTM data is available at 30-meter resolution via the USGS/SRTMGL1/SRTMGL1_003 collection.


var srtm = ee.Image('USGS/SRTMGL1/SRTMGL1_003');

Step 2: Visualize Elevation Data

Visualizing the DEM provides an initial understanding of the terrain. You can use a color palette to represent elevation values.


Map.setCenter(-122.082, 37.422, 10); // Example coordinates
var elevation = srtm.select('elevation');
var elevationVis = {min: 0, max: 3000, palette: ['00008B', '00BFFF', 'FFD700', 'FFFFFF']};
Map.addLayer(elevation, elevationVis, 'Elevation');

Step 3: Calculate Slope and Aspect

Slope and aspect are critical for understanding terrain dynamics. Use the slope() and aspect() methods of the ee.Image class to derive these parameters.


var slope = elevation.slope();
var aspect = elevation.aspect();

Step 4: Generate Hillshade

A hillshade layer enhances the 3D view of the DEM by simulating illumination. This is useful for detecting landforms.


var hillshade = elevation.hillshade();
Map.addLayer(hillshade, {max: 255}, 'Hillshade');

Step 5: Combine Layers for Enhanced Visualization

Overlay hillshade with elevation data to create a visually rich terrain map.


var elevationWithHillshade = ee.Image.cat([elevation, hillshade]).select(['elevation', 'hillshade']);
var elevationWithHillshadeVis = {min: 0, max: 3000, palette: ['00008B', '00BFFF', 'FFD700', 'FFFFFF'], bands: ['elevation', 'hillshade'], gain: 1.5};
Map.addLayer(elevationWithHillshade, elevationWithHillshadeVis, 'Elevation + Hillshade');

Step 6: Advanced Analysis – Watersheds or Drainage Patterns

For more advanced workflows, use the ee.Terrain module or perform hydrological analysis with functions like flowDirection() and flowAccumulation().


var terrain = ee.Terrain.slope(elevation);
var watersheds = elevation.flowDirection();

Exporting Results

To export terrain analysis results, use the Export.image.toDrive() function. Customize the export parameters for resolution, region, and format.


Export.image.toDrive({
image: slope,
description: 'slope_export',
folder: 'GEE_exports',
fileNamePrefix: 'slope_map',
region: geometry,
scale: 30,
maxPixels: 1e10
});

FAQ Section

What is SRTM DEM and why is it used in GEE?

SRTM DEM (Shuttle Radar Topography Mission Digital Elevation Model) is a high-resolution elevation dataset covering most of Earth’s landmass. It is widely used in GEE for its accuracy and global coverage, enabling terrain analysis for environmental, geological, and urban planning applications.

Why isn’t my SRTM DEM showing up on the map?

Ensure you’ve selected the correct band (e.g., ‘elevation’) and set the visualization parameters properly. If the image is too large, use clip() or geometry() to restrict the region.

How do I calculate slope in GEE?

Slope is calculated using the slope() method on an elevation image. It returns an image where each pixel value represents the steepness of the terrain in degrees.

Can I use SRTM with other datasets in GEE?

Yes, SRTM can be combined with other datasets (e.g., land cover, satellite imagery) for multi-layer analysis. Use image.select() and image.addBands() to merge datasets.

How to handle missing data in SRTM?

SRTM data may have gaps due to radar shadowing. Use image.mask().not() to identify and handle missing pixels. Alternatively, consider using ALOS PALSAR or other DEMs for fill-in data.

What is the resolution of SRTM DEM in GEE?

SRTM DEM in GEE has a resolution of 30 meters (~0.0003 degrees), suitable for regional-scale analysis but may not be ideal for very small areas.

How to calculate aspect using GEE?

Aspect is derived using the aspect() method on the elevation image. It returns an image where each pixel represents the direction of steepest slope, measured in degrees from north.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *