> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RS_Stack

Returns a combined multi-band raster from 2 or more input Rasters, stacking their bands. The order of bands in the resultant raster will be in the order of the input rasters. For example if `RS_Stack` is called on two 2-banded raster, raster1 and raster2, the first 2 bands of the resultant 4-banded raster will be from raster1 and the last 2 from raster 2.

<Note>
  If the provided input Rasters don't have same shape an IllegalArgumentException will be thrown.
</Note>

<img src="https://mintcdn.com/wherobots/JxwS8LefxfdGaqWp/images/sql-functions/RS_Stack/RS_Stack.svg?fit=max&auto=format&n=JxwS8LefxfdGaqWp&q=85&s=5bd4b7fb1791968b2a3efb61c528109a" alt="RS_Stack" width="800" height="440" data-path="images/sql-functions/RS_Stack/RS_Stack.svg" />

<Note>
  `RS_Stack` replaces `RS_Union`. It stacks bands from rasters with matching shapes; it does not mosaic spatially adjacent raster grids. The old function name is removed. See [Geometry and raster API migration](/reference/wherobots-db/geometry-raster-api-migration).
</Note>

## Signatures

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster)
```

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster, raster3: Raster)
```

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster, raster3: Raster, raster4: Raster)
```

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster, raster3: Raster, raster4: Raster, raster5: Raster)
```

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster, raster3: Raster, raster4: Raster, raster5: Raster, raster6: Raster)
```

```sql theme={"system"}
RS_Stack (raster1: Raster, raster2: Raster, raster3: Raster, raster4: Raster, raster5: Raster, raster6: Raster, raster7: Raster)
```

## Parameters

<ParamField body="raster1" type="Raster" required>
  The raster1 value.
</ParamField>

<ParamField body="raster2" type="Raster" required>
  The raster2 value.
</ParamField>

<ParamField body="raster3" type="Raster">
  The raster3 value.
</ParamField>

<ParamField body="raster4" type="Raster">
  The raster4 value.
</ParamField>

<ParamField body="raster5" type="Raster">
  The raster5 value.
</ParamField>

<ParamField body="raster6" type="Raster">
  The raster6 value.
</ParamField>

<ParamField body="raster7" type="Raster">
  The raster7 value.
</ParamField>

## Return type

<ResponseField type="Raster">
  The resulting raster.
</ResponseField>

## Example

```sql theme={"system"}
SELECT RS_Stack(raster1, raster2, raster3, raster4) FROM rasters
```

```
GridCoverage2D["g...
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.