Download 30m DEM for any country using GEE.

Quick Overview:

This work aims at providing an interactive interface to download 30m resolution DEM for any country. This JavaScript code works in the Google Earth Engine interface and is well scripted in a way that you change the name of the country, run the code, and get the DEM. This code also gives you a hill-shade, elevation palette, and sea mask. Feel free to edit and play around with the code.

Data Overview

The Global Multi-resolution Terrain Elevation Data 2010 (GMTED2010) dataset contains elevation data for the globe collected from various sources. The version of the dataset available here is Breakline Emphasis, 7.5 arc-seconds resolution. Breakline emphasis maintains the critical topographic features (streams or ridges) within the landscape by maintaining any minimum elevation or maximum elevation value on a breakline that passes within the specified analysis window. More details are available in the dataset report.

The primary source dataset for GMTED2010 is NGA’s SRTM Digital Terrain Elevation Data (DTED®, (void-filled) 1-arc-second data. For the geographic areas outside the SRTM coverage area and to fill in remaining holes in the SRTM data, the following sources were used: non-SRTM DTED®, Canadian Digital Elevation Data (CDED) at two resolutions, Satellite Pour l’Observation de la Terre (SPOT 5) Reference3D, National Elevation Dataset (NED) for the continental United States and Alaska, GEODATA 9 second digital elevation model (DEM) for Australia, and Antarctica satellite radar and laser altimeter DEM, and a Greenland satellite radar altimeter DEM.

This dataset replaces the GTOPO30 Elevation Model.

Here is the code:

// Select the country
var countries = ee.FeatureCollection("ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw")
var country_name = ['Nepal'] //Change the country name here, for example: India
var country = countries.filter(ee.Filter.inList('Country', country_name));

//Zoom to Study area
Map.centerObject(country, 5);  

// Use an elevation dataset and terrain functions to create a custom visualization of topography.
// Load a global elevation image.
var elev = ee.Image('USGS/GMTED2010')

// Add the elevation to the map.
Map.addLayer(elev, {}, 'elev');

// Create a custom elevation palette from hex strings.
var elevationPalette = ['006600', '002200', 'fff700', 'ab7634', 'c4d0ff', 'ffffff'];
// Use these visualization parameters, customized by location.
var visParams = {min: 0, max: 8000, palette: elevationPalette};

// Use the terrain algorithms to compute a hillshade with 8-bit values.
var shade = ee.Terrain.hillshade(elev);
var clipped = shade.clipToCollection(country);
Map.addLayer(shade.clip(country), {palette:elevationPalette}, 'Hillshade', false);

// Create a "sea" variable to be used for cartographic purposes
// Dont use it if your coounty is landlocked. 
var sea = elev.lte(0);
Map.addLayer(sea.mask(sea), {palette:'092095'}, 'sea', false);

// Create a mosaic of the sea and the elevation data
var visualized = ee.ImageCollection([
  // Mask the elevation to get only land
  // Use the sea mask directly to display sea.

// Note that the visualization image doesn't require visualization parameters.
Map.addLayer(visualized.clip(country), {}, 'elev palette',false);

// Convert the visualized elevation to HSV, first converting to [0, 1] data.
var hsv = visualized.divide(255).rgbToHsv();
// Select only the hue and saturation bands.
var hs =, 1);
// Convert the hillshade to [0, 1] data, as expected by the HSV algorithm.
var v = shade.divide(255);
// Create a visualization image by converting back to RGB from HSV.
// Note the cast to byte in order to export the image correctly.
var rgb = hs.addBands(v).hsvToRgb().multiply(255).byte();
Map.addLayer(rgb.clip(country), {}, 'styled');

var image = ee.Image().toByte()
    //.paint(roi, 'fill') // Get color from property named 'fill'
    .paint(country, 2, 2); // Outline using color 3, width 5.
Map.addLayer(image, {palette: ['000000', '000000', '000000', '000000'], max: 0.5, opacity: 0.9,},'Boundary_of_'+ country_name);

// Export the DEM. The DEM will be exported to your google drive. 
var FileName = 'DEM'
var resolution = 30;
var projection = "EPSG:5070"; //" "EPSG:4269"; 

  image: elev.clip(country),
  description: FileName + country_name,
  folder: 'DEM',
  scale: resolution,
  crs: projection,
  region: country,
  maxPixels: 52041951120

Once you run the code, check the “Task” tab. There should be a file name DEM + country_name (e.g: DEM Nepal). Click run. This should export the dem file to your google drive. Once done, log in to your google drive. Under the folder “DEM” there should be your dataset.


14 thoughts on “Download 30m DEM for any country using GEE.”

  1. Hi Mr. Shrestha.
    You have posted interesting applications for a larger audience. I believe such applications would inspire not only GIS/Remote Sending professionals, but also other technology enthusiasts to explore the dynamics of the human-environment interface. Good Job!

  2. Pingback: Develop a Harmonic Model: Original vs Fitted NDVI values (Study Area: Thailand) – DINESH SHRESTHA

  3. Pingback: Using Hansen Global Forest Change Data to determine Forest Cover, Forest Gain, and Forest Loss (Study Area: Malaysia) – DINESH SHRESTHA

  4. Pingback: Make your map look Artistic – Add Grid Lines in your Map (Study Area: Canada) – DINESH SHRESTHA

  5. Pingback: Night Light Maps (Study Area: South Asia) – DINESH SHRESTHA

  6. Pingback: How to generate Histogram in Google Earth Engine? – DINESH SHRESTHA

  7. Pingback: Using 2001 MODIS Land Cover Type Yearly Global 500m Data to Determine the Land-Cover Analysis (Study Area: Mexico) – DINESH SHRESTHA

  8. Pingback: Learn How to Add two charts next to the map to interactively display a time-series of NDVI and reflectance for each click on the map? – DINESH SHRESTHA

  9. Pingback: Create a Chart to show Landsat 8 TOA Spectra at three points near Mumbai City – DINESH SHRESTHA

  10. Pingback: Learn how to calculate and export 90th Percentile Annual NDVI for years 1985-2019 using Landsat 8, 7, and 5 scenes (Study Area: Turkey) – DINESH SHRESTHA

  11. Pingback: Use 2018 Landsat 8 Scenes for Land Cover Classification in Google Earth Engine (Study Area: Dubai) – DINESH SHRESTHA

  12. Pingback: Land Cover Change Analysis between 1999 and 2018 in GEE (Study Area: Mumbai) – DINESH SHRESTHA

  13. Pingback: Time-lapse: Animate 30m Landsat images generated 90th percentile Annual NDVI from 1999 to 2018 (Study Area: South America) – DINESH SHRESTHA

Leave a Reply

%d bloggers like this: