Skip to main content
Rewrites a band’s existing no-data pixels to noDataValue and sets that value as the band’s no-data metadata. RS_SetBandNoDataValue changes only the metadata. Pixels that already equal the new value also become no-data; choose a value exactly representable in the band’s pixel type and absent from valid pixels to preserve the same no-data mask. A pixel matches the existing no-data value numerically: -0.0 matches 0.0, and any NaN matches a NaN no-data value. Other bands are unchanged. The band must already have a no-data value; otherwise the function throws an IllegalArgumentException. A NULL raster, band index, or noDataValue returns NULL.

Signatures

Parameters

Raster
required
The input raster.
Integer
required
The 1-based band index.
Double
required
The replacement no-data value.

Return type

A raster with the selected band’s existing no-data pixels rewritten and its no-data metadata updated.

Example

The band’s no-data value starts at 0. Moving it to -9999 preserves the two valid pixels: