ST_SetColorTable
Updated at:
Copy as MD
Sets the color table of a specified band in a raster object. The color table is provided in JSON format.
Syntax
raster ST_SetColorTable(raster rast, integer band_sn, cstring clb);Parameters
| Parameter | Description |
| rast | The raster object. |
| band_sn | The sequence number of the band. Band numbering starts at 0. |
| clb | The color table in JSON format. For the JSON format, see ST_ColorTable. |
Examples
The following example sets the color table for band 0 of a raster object. The color table defines four components (compsCount: 4) and three entries mapped to pixel values 0, 1, and 2.
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)Is this page helpful?