Skip to content

RT_SelectBands takes a raster column and an array of numeric values that represent the band IDs and returns a raster column. The function selects or reorders the bands in the output raster using the specified band IDs. If the band IDs are out of range, the function will return null.

FunctionSyntax
Pythonselect_bands(raster_col, band_ids)
SQLRT_SelectBands(raster_col, band_ids)
ScalaselectBands(raster, bandIds)

For more details, go to the GeoAnalytics Engine API reference for select_bands.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8

from geoanalytics.raster import functions as RT

data = [([1,2,3,4], )]
df = spark.createDataFrame(data, ["pixels"]) \
     .withColumn("raster", RT.create_raster("pixels", 2, 2, "int32"))

df.select(RT.select_bands("raster", [1]).alias("select_bands")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+-----------------------+
|select_bands           |
+-----------------------+
|SqlRaster(1x2x2, Int32)|
+-----------------------+

Version table

ReleaseNotes

2.0.0

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.