Skip to content

RS_Stack

Returns one raster holding the bands of any number of rasters, in argument order.

Usage

raster RS_Stack(rast: raster, rasters: raster)

Arguments

  • rast (raster): Input raster
  • rasters (raster): One or more further rasters (any number), on the same grid as the first: the same width, height, geotransform and CRS.

[!WARNING]

Experimental. This function is experimental; its behavior may change without notice.

Description

Sedona Spark 1.9 calls this function RS_Union.

The result holds every band of the first raster, then every band of the second, and so on. Each band keeps its own pixel type, nodata value and name, so rasters of different pixel types can be stacked. Every raster must be on the first raster’s grid (the same width, height, geotransform and CRS); a raster on any other grid is an error. A band’s spatial dimensions take the first raster’s names, matched by role, so a lat/lon raster stacked onto a y/x raster gives y/x bands; a band with another dimension already named y or x is an error. A NULL raster gives a NULL result.

No pixel is read: bands are carried over as they are, so stacking rasters that are still out-of-database does not load them.

Examples

SELECT RS_NumBands(RS_Stack(RS_Example(), RS_Example()));
┌──────────────────────────────────────────────────┐
│ rs_numbands(rs_stack(rs_example(),rs_example())) │
│                      uint32                      │
╞══════════════════════════════════════════════════╡
│                                                6 │
└──────────────────────────────────────────────────┘