Digital Elevation Models (DEMs) are fundamental datasets in geoscience, hydrology, environmental studies, infrastructure planning, and hydrogeology. In Kenya, DEMs are widely used for borehole siting, watershed delineation, flood risk assessment, slope stability analysis, and terrain modeling. One of the most powerful platforms for accessing and processing DEM data is Google Earth Engine (GEE).
This article explains, step by step, how to extract a DEM for Kenya using Google Earth Engine, based on the JavaScript code provided earlier. The process includes defining Kenya’s boundary, loading elevation data, clipping the DEM, visualizing it, and exporting it for use in GIS software such as QGIS or ArcGIS.
Understanding What a DEM Is
A Digital Elevation Model (DEM) is a raster dataset where each pixel represents the elevation of the Earth’s surface at that location. Elevation values are typically measured in meters above sea level.
In Kenya, DEM data is useful for:
-
Groundwater exploration and recharge mapping
-
Watershed and drainage analysis
-
Road and infrastructure design
-
Environmental impact assessments
-
Geotechnical investigations
-
Flood and erosion modeling
Google Earth Engine provides access to globally available DEM datasets such as:
-
SRTM (Shuttle Radar Topography Mission) – 30m resolution
-
ALOS PALSAR DEM – approximately 12.5m resolution
In the example provided, we use the SRTM 30m dataset.
Step 1: Access Google Earth Engine
To begin:
-
Sign in with your Google account.
-
Open the Code Editor interface.
The interface contains:
-
A script panel (where you paste your code)
-
A map display window
-
A console panel for outputs
Step 2: Define Kenya’s Boundary
The first step in the script is defining Kenya as the area of interest.
What This Does:
-
ee.FeatureCollectionloads a global country boundary dataset. -
"USDOS/LSIB_SIMPLE/2017"is a simplified international boundary dataset. -
.filter()selects only the country where the name equals “Kenya”.
This ensures that all further analysis will focus strictly on Kenya.
Why this is important:
Without defining a boundary, Earth Engine would process global data, which would be inefficient and unnecessary.
Step 3: Load the DEM Dataset
Next, we load the SRTM elevation dataset:
What This Means:
-
"USGS/SRTMGL1_003"refers to the 30-meter resolution SRTM DEM. -
It provides near-global elevation coverage.
-
Elevation values are in meters above sea level.
The dataset is already stored in Google Earth Engine’s cloud infrastructure, meaning you do not need to download raw files manually.
Step 4: Clip the DEM to Kenya
To limit the DEM strictly to Kenya’s borders:
What Happens Here:
-
.clip()cuts the DEM to match the Kenya boundary. -
All elevation values outside Kenya are removed.
-
Processing becomes faster and more efficient.
This is especially important when exporting data because it reduces file size and ensures precision.
Step 5: Visualizing the DEM
To display the DEM properly, visualization parameters are defined:
Explanation:
-
min: 0→ Lowest elevation displayed (coastal areas). -
max: 4000→ Highest elevation displayed (Mt. Kenya region). -
palette→ Defines color transitions:-
Blue → Low elevations
-
Green → Moderate elevations
-
Yellow/Orange → Highlands
-
Brown → Very high elevations
-
Then the DEM is displayed:
What This Does:
-
Centers the map over Kenya.
-
Adds the country boundary layer.
-
Displays the DEM with color styling.
You will now visually see Kenya’s topography, including:
-
Coastal lowlands
-
Rift Valley escarpments
-
Central highlands
-
Mt. Kenya region
-
Western plateau
Step 6: Export the DEM to Google Drive
The final step is exporting the DEM for offline GIS use:
Breakdown of Parameters:
-
image→ The clipped DEM -
description→ Name of export task -
folder→ Google Drive folder -
fileNamePrefix→ Output file name -
region→ Kenya boundary -
scale: 30→ 30m pixel resolution -
crs: 'EPSG:4326'→ Geographic coordinate system -
maxPixels→ Prevents export errors for large datasets
How to Complete the Export:
-
Click Run in the Code Editor.
-
Go to the Tasks tab.
-
Click Run next to the export task.
-
Confirm export settings.
-
Wait for processing to complete.
-
Download the GeoTIFF from Google Drive.
You can now open the DEM in:
-
QGIS
-
ArcGIS
-
Global Mapper
-
Surfer
-
Any GIS software
Optional: Using Higher Resolution DEM
If higher detail is required (e.g., for hydrogeological siting), you can replace SRTM with ALOS:
This provides improved vertical accuracy in many regions.
Applications of Extracted DEM in Kenya
Once exported, the DEM can be used for:
1. Slope Analysis
-
Borehole siting
-
Landslide risk assessment
-
Road design
2. Drainage and Watershed Delineation
-
Flood risk mapping
-
Catchment planning
-
Water harvesting design
3. Contour Generation
-
Engineering surveys
-
Topographic mapping
4. Groundwater Exploration
-
Identifying recharge zones
-
Mapping structural controls
-
Lineament analysis (when combined with satellite imagery.
Conclusion
Extracting a DEM for Kenya using Google Earth Engine is a straightforward yet powerful process. By defining Kenya’s boundary, loading SRTM elevation data, clipping the dataset, visualizing it, and exporting it to Google Drive, you can generate a high-quality elevation model ready for professional analysis.
This workflow is particularly valuable for:
-
Hydrogeological surveys
-
Borehole siting
-
Environmental assessments
-
Infrastructure planning
-
Terrain and watershed modeling
With just a few lines of JavaScript code, Google Earth Engine enables efficient, cloud-based extraction of DEM data for Kenya, eliminating the traditional challenges of downloading and mosaicking large elevation datasets.
If needed, this workflow can be expanded to include slope, aspect, hillshade, or watershed analysis for more advanced geospatial studies.



