Skip to main content Link Menu Expand (external link) Document Search Copy Copied

DEM Topographic Visualization

// DEM Topographic Visualization
//VERSION=3
function setup() {
  return {
    input: ["DEM"],
    output: { bands: 3 }
  };
}

function evaluatePixel(sample) {

  let val = sample.DEM;
  let imgVals = null;

  if (val > 8000) imgVals = [1, 1, 1];
  else if (val > 7000) imgVals = [0.95, 0.95, 0.95];
  else if (val > 6000) imgVals = [0.9, 0.9, 0.9];
  else if (val > 5500) imgVals = [0.29, 0.22, 0.07];
  else if (val > 5000) imgVals = [0.37, 0.30, 0.15];
  else if (val > 4500) imgVals = [0.45, 0.38, 0.22];
  else if (val > 4000) imgVals = [0.53, 0.45, 0.30];
  else if (val > 3500) imgVals = [0.6, 0.53, 0.38];
  else if (val > 3000) imgVals = [0.68, 0.61, 0.46];
  else if (val > 2500) imgVals = [0.76, 0.69, 0.54];
  else if (val > 2000) imgVals = [0.84, 0.77, 0.62];
  else if (val > 1500) imgVals = [0.92, 0.85, 0.69];
  else if (val > 1000) imgVals = [0.99, 0.93, 0.75];
  else if (val > 900) imgVals = [0.67, 0.87, 0.63];
  else if (val > 800) imgVals = [0.65, 0.84, 0.61];
  else if (val > 700) imgVals = [0.59, 0.81, 0.56];
  else if (val > 600) imgVals = [0.52, 0.76, 0.48];
  else if (val > 500) imgVals = [0.48, 0.73, 0.44];
  else if (val > 400) imgVals = [0.45, 0.70, 0.40];
  else if (val > 300) imgVals = [0.37, 0.64, 0.33];
  else if (val > 200) imgVals = [0.30, 0.58, 0.25];
  else if (val > 100) imgVals = [0.24, 0.53, 0.24];
  else if (val > 75) imgVals = [0.21, 0.49, 0.23];
  else if (val > 50) imgVals = [0.18, 0.45, 0.18];
  else if (val > 25) imgVals = [0.15, 0.41, 0.13];
  else if (val > 10) imgVals = [0.12, 0.37, 0.08];
  else if (val > 0) imgVals = [0.09, 0.33, 0.03];
  else imgVals = [0.06, 0.06, 0.55];

  return imgVals;
}

Evaluate and visualize

Description

Sentinel Hub supports Mapzen DEM and Copernicus DEM. Mapzen DEM is based on SRTM30 (Shuttle Radar Topography Mission) and other sources. Copernicus DEM is based on WorldDEM that is infilled on a local basis with the following DEMs: ASTER, SRTM90, SRTM30, SRTM30plus, GMTED2010, TerraSAR-X Radargrammetric DEM, ALOS World 3D-30m. More information can be found in our documentation.

This script returns a visualisation with green colours representing lowland elevations and earth colours as mountainous elevations. The script uses discrete classes rather than the continuous visualisations in the other DEM evalscripts in this repository.

dem topographic visualisation

Color table

Elevation range HTLM color code Color
Below Sea Level #0f0f8c
0-10m #175408
10-25m #1f5e14
25-50m #266921
50-75m #2e732e
75-100m #367d3b
100-200m #3d873d
200-300m #4d9440
300-400m #5ea354
400-500m #73b366
500-600m #7aba70
600-700m #85c27a
700-800m #96cf8f
800-900m #a6d69c
900-1000m #abdea1
1000-1500m #fcedbf
1500-2000m #ebd9b0
2000-2500m #d6c49e
2500-3000m #c2b08a
3000-3500m #ad9c75
3500-4000m #998761
4000-4500m #87734d
4500-5000m #736138
5000-5500m #5e4d26
5500-6000m #4a3812
6000-7000m #e6e6e6
7000-8000m #f2f2f2
8000m + #ffffff

Author of the script

William Ray