Skip to content
Apache Sedona 1.9.0 is out now, featuring Spark 4.1 support, proj4sedona CRS transformation, Bing Tile functions, and more!

RS_BandAsArray

Introduction: Extract a band from a raster as an array of doubles.

Format: RS_BandAsArray (raster: Raster, bandIndex: Integer).

Return type: Array<Double>

Since: v1.4.1

BandIndex is 1-based and must be between 1 and RS_NumBands(raster). It returns null if the bandIndex is out of range or the raster is null.

SQL Example

SELECT RS_BandAsArray(raster, 1) FROM raster_table

Output:

+--------------------+
|                band|
+--------------------+
|[0.0, 0.0, 0.0, 0...|
+--------------------+