Skip to main content
This sets the no data value for a specified band in the raster. If the band index is not provided, band 1 is assumed by default. Passing a null value for noDataValue will remove the no data value and that will ensure all pixels are included in functions rather than excluded as no data. Only the band’s metadata changes; pixel values are left unchanged. To rewrite existing no-data pixels and update the band’s no-data value, use RS_ReplaceBandNoDataValue.
The four-argument form with a replace flag is removed. Replace RS_SetBandNoDataValue(raster, bandIndex, noDataValue, true) with RS_ReplaceBandNoDataValue(raster, bandIndex, noDataValue). For replace = false, remove the fourth argument. See Geometry and raster API migration.

Signatures

Parameters

Raster
required
The input raster.
Integer
required
The band index value.
Double
required
The value to declare as no-data for the band, or NULL to remove the no-data metadata. Pixel values are unchanged.

Return type

The resulting raster.

Example

NaN no-data values

A floating-point band can use NaN as its no-data value. Every NaN pixel then counts as no-data. Setting NaN on an integer band throws an IllegalArgumentException.