DEM colormap for Central Europe

//VERSION=3
// To set custom max and min values, set
// choose your max and min values.
// The color map will then be scaled
// to those max and min values
const max = 3500;
const min = -200;

function setup() {
  return {
    input: ["DEM", "dataMask"],
    output: [
      { id: "default", bands: 4, sampleType: "AUTO" },
      { id: "index", bands: 1, sampleType: "FLOAT32" },
      { id: "dataMask", bands: 1 },
    ],
  };
}

const map = [
  [3500, 0xf7eafd],
  [3000, 0xebebeb],
  [1000, 0xa76b18],
  [500, 0xdca620],
  [200, 0xA2AE32],
  [100, 0x18a722],
  [50, 0x018643],
  [30, 0x15965],
  [10, 0x01471c],
  [0, 0xbbbcbc],
  [-10, 0x2754de],
  [-20, 0x0d027e],
  [-50, 0x08014c],
  [-200, 0x4a4a4a],
];

const visualizer = new ColorRampVisualizer(map, min, max);

function evaluatePixel(samples) {
  const imgVals = visualizer.process(samples.DEM)

  // Return the 4 inputs and define content for each one
  return {
    default: [...imgVals, samples.dataMask],
    index: [samples.DEM],
    dataMask: [samples.dataMask],
  }
}

Evaluate and Visualize

This color ramp is defined to make interpreting topography on the Copernicus 30 DEM in Central Europe easy. Therefore, it runs between -200 and 3500 m above sea level. It uses classical colours typical for elevation maps: brown and white for high mountains and greens for lowland areas. Note that since the Copernicus 30 DEM does not include a seafloor model, the elevations below 0 m ASL are not used.

Example location

The example is a site near Kosice, Slovakia, showing an elevation gradient between the Zemplín mountains and the Ondava river floodplain

examples:
- zoom: '11'
  lat: '48.81432'
  lng: '21.52702'
  datasetId: DEM
  fromTime: '2020-07-12T00:00:00.000Z'
  toTime: '2020-07-12T23:59:59.999Z'
  platform:
  - CDSE
  - EOB
  evalscripturl: https://custom-scripts.sentinel-hub.com/custom-scripts/dem/dem-central-europe/script.js

General description of the script

Color Table

Value Color Code Color Patch
3500 #f7eafd
3000 #ebebeb
1000 #a76b18
500 #dca620
200 #A2AE32
100 #18a722
50 #018643
30 #015965
10 #01471c
0 #bbbcbc
-10 #2754de
-20 #0d027e
-50 #08014c
-200 #4a4a4a

Author of the script

András Zlinszky, Sinergise