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.
| Function | Syntax |
|---|---|
| Python | select |
| SQL | RT |
| Scala | select |
For more details, go to the GeoAnalytics Engine API reference for select_bands.
Examples
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
+-----------------------+
|select_bands |
+-----------------------+
|SqlRaster(1x2x2, Int32)|
+-----------------------+Version table
| Release | Notes |
|---|---|
2.0.0 | Python, SQL, and Scala functions introduced |