ST_SetColorTable

更新时间:
复制 MD 格式

Sets the color table for a specified band of a raster object. The color table is provided as a JSON string.

Syntax

raster ST_SetColorTable(raster rast, integer band_sn, cstring clb)

Parameters

ParameterDescription
rastThe raster object.
band_snThe band sequence number, starting from 0.
clbThe color table in JSON format. For more information, see ST_ColorTable.

Examples

Set a 4-component (RGBA) color table on band 0:

UPDATE rast
SET rast = ST_SetColorTable(rast, 0,
  '{"compsCount": 4,
    "entries": [
      {"value": 0, "c1": 0, "c2": 0, "c3": 0,   "c4": 255},
      {"value": 1, "c1": 0, "c2": 0, "c3": 85,  "c4": 255},
      {"value": 2, "c1": 0, "c2": 0, "c3": 170, "c4": 255}
    ]
  }');

Output:

(1 row)

See also

  • ST_ColorTable — Returns the color table of a band as a JSON string.