Skip to content
πŸŽ‰ Apache Sedona 1.9.1 is out now! πŸ—ΊοΈ Geography SQL functions, Box2D & Box3D types, raster Python UDFs & more. Read the release notes β†’

RS_BandNoDataValue

Introduction: Returns the no data value of the given band of the given raster. If no band is given, band 1 is assumed. The band parameter is 1-indexed. If there is no data value associated with the given band, RS_BandNoDataValue returns null.

Note

If the given band does not lie in the raster, RS_BandNoDataValue throws an IllegalArgumentException

Note

NaN is a valid no data value for floating point bands, and RS_BandNoDataValue returns NaN (not null) for a band that declares it. GDAL writes GDAL_NODATA=nan for such rasters and RS_FromGeoTiff keeps it. Functions that exclude no data pixels, such as RS_Count, RS_SummaryStats and RS_ZonalStats, treat every NaN pixel as no data in that case.

Format: RS_BandNoDataValue (raster: Raster, band: Integer = 1)

Return type: Double

Since: v1.5.0

SQL Example

SELECT RS_BandNoDataValue(raster, 1) from rasters;

Output:

0.0

SQL Example

SELECT RS_BandNoDataValue(raster) from rasters_without_nodata;

Output:

null

SQL Example

SELECT RS_BandNoDataValue(raster, 3) from rasters;

Output:

IllegalArgumentException: Provided band index 3 is not present in the raster.