All Products
Search
Document Center

PolarDB:ST_SetNoData

Last Updated:Mar 28, 2026

Sets the NoData value for a specified band of a raster object. Setting a NoData value marks which pixel value represents "no data" — it does not modify existing pixel values in the raster.

Syntax

raster ST_SetNoData(raster rast, integer band_sn, double nodata_value);

Parameters

ParameterDescription
rastThe raster object.
bandThe sequence number of the band, starting from 0. Pass -1 to apply the NoData value to all bands.
nodata_valueThe NoData value to assign to the band.

Examples

Set a NoData value for a single band

Set the NoData value for band 0 to 999.999:

UPDATE rast SET rast = ST_SetNoData(rast, 0, 999.999);

Expected output:

(1 row)

Set a NoData value for all bands

Set the same NoData value for all bands:

UPDATE rast SET rast = ST_SetNoData(rast, -1, 999.999);