Google Earth Engine Tutorial: Create Hillshade Maps
Credit: Youtube Channel “Terra Spatial, Tutorial on creating hillshade maps from DEM data for enhanced terrain visualization and analysis.”
You can see all the tutorials from here: Techgeo Academy.
Hillshade Maps in Google Earth Engine
Hillshade maps are a powerful tool in GIS for visualizing terrain elevation and topography. They use simulated sunlight to create a 3D-like representation of the landscape, enhancing the perception of elevation changes. Google Earth Engine (GEE) provides an efficient way to generate hillshade maps using its built-in algorithms and accessible datasets. Below is a step-by-step guide to creating hillshade maps with GEE.
Installation and Setup
To begin, you need to access the Google Earth Engine platform. Visit https://earthengine.google.com and sign in with your Google account. Once logged in, you can use the code editor to write and run your scripts. Ensure you have the necessary permissions and access to elevation datasets like SRTM (Shuttle Radar Topography Mission) or ASTER.
Accessing Elevation Data
Load an elevation dataset into your script. A commonly used dataset is the SRTM Global 30-meter elevation data. Here’s an example of how to load it:
var elevation = ee.Image("USGS/SRTMGL1_003");
This code imports the SRTM dataset. You can replace the dataset name with another if needed, such as “NASA/ASTER/GDEM/V003” for ASTER data.
Creating the Hillshade
Use Google Earth Engine’s ee.Algorithms.Hillshade
function to generate a hillshade layer from the elevation data. This function requires the elevation image and optional parameters like azimuth and altitude of the light source. Here’s a sample code:
var hillshade = ee.Algorithms.Hillshade(elevation, 30, 30);
The parameters 30, 30
represent the azimuth (direction of the light) and altitude (elevation angle of the light source). Adjust these values to simulate different lighting conditions.
Customizing the Hillshade
After generating the hillshade, you can enhance or modify its appearance. For instance, you can merge the hillshade with a base map or use a custom color palette for better visualization:
Map.addLayer(hillshade, {palette: ['white', 'black']}, 'Hillshade');
Explore the visParams
parameter for additional customization, such as transparency or contrast adjustments.
Exporting the Hillshade Map
To export your hillshade map as a file, use the Export.image.toDrive
function. Specify the image, output name, and other parameters like scale and region:
Export.image.toDrive({
image: hillshade,
description: 'Hillshade_Map',
fileNamePrefix: 'hillshade',
scale: 30,
region: elevation.geometry(),
maxPixels: 1e10
});
Ensure you select the correct region and scale to match your requirements. The maxPixels
parameter must be set to a sufficiently high value to avoid errors with large datasets.
FAQ
What elevation datasets are compatible with hillshade generation in GEE?
Google Earth Engine supports various elevation datasets, including SRTM, ASTER GDEM, and others. Verify the dataset’s resolution and availability before use.
Why does my hillshade map look flat or lack detail?
This could be due to the default parameters of the hillshade function, which might not account for local terrain variations. Adjust the azimuth and altitude values to create more contrast and depth in the visualization.
Can I combine the hillshade with other layers, such as satellite imagery?
Yes. Use the Map.addLayer
function to overlay the hillshade with other data layers, such as Landsat or MODIS imagery, for enhanced analysis and visual appeal.
How do I change the color palette of the hillshade?
Modify the palette
parameter in the Map.addLayer
function. For example, {palette: [‘gray’, ‘brown’]} creates a grayscale or brown-hued hillshade.
Is hillshade generation compatible with all regions of the world?
Hillshade maps are generated based on elevation data, which may have coverage gaps in some areas. Check the quality of the elevation dataset for your region and consider mosaicing or interpolating data if necessary.