Discrete color ramp for GeoTIFF in OpenLayers

33 Views Asked by At

How can the following continuous color ramp be converted to a discrete one assuming, let's say, 5 more levels with random colors?

color: [
    'case',
    ['>', ['band', 2], 0],
    [
      'interpolate',
      ['linear'],
      ['band', 1],
      0,
      [255, 255, 255],
      76,
      [0, 0, 0],
    ],
    [0, 0, 0, 0],
  ],

Based on some documentation on the web, I tried the following without success:

color: [
  'case',
  ['>', ['band', 2], 0],
  [
    'case',
    ['<=', ['band', 1], -6400], [11, 4, 5],
    ['between', ['band', 1], -6400, -4800], [62, 53, 107],
    ['between', ['band', 1], -4800, -3200], [53, 123, 163],
    ['between', ['band', 1], -3200, -1600], [75, 194, 173],
    ['>=', ['band', 1], -1600], [222, 245, 229],
  ],
  [0, 0, 0, 0],
],

Any pointers are much appreciated,

0

There are 0 best solutions below