> ## 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_ReprojectMatch

Reproject a raster to match the geo-reference, CRS, and envelope of a reference raster. The output raster
always have the same extent and resolution as the reference raster. For pixels not covered by the input raster, nodata
value is assigned, or 0 is assigned if the input raster does not have nodata value.

The default resampling algorithm is `NearestNeighbor`. The following resampling algorithms are supported (case-insensitive):

1. NearestNeighbor
2. Bilinear
3. Bicubic

This function serves the same purpose as the [`RasterArray.reproject_match` function in rioxarray](https://corteva.github.io/rioxarray/html/rioxarray.html#rioxarray.raster_array.RasterArray.reproject_match).

<img src="https://mintcdn.com/wherobots/AayJA2u8CknIeTgt/images/sql-functions/RS_ReprojectMatch/RS_ReprojectMatch.svg?fit=max&auto=format&n=AayJA2u8CknIeTgt&q=85&s=338993affa7905175ee1bb498225fc09" alt="RS_ReprojectMatch" width="920" height="440" data-path="images/sql-functions/RS_ReprojectMatch/RS_ReprojectMatch.svg" />

<img src="https://mintcdn.com/wherobots/AayJA2u8CknIeTgt/images/sql-functions/RS_ReprojectMatch_clip/RS_ReprojectMatch_clip.svg?fit=max&auto=format&n=AayJA2u8CknIeTgt&q=85&s=299ad2e30f3a4880d7e8192cc82f7da7" alt="RS_ReprojectMatch_clip" width="920" height="440" data-path="images/sql-functions/RS_ReprojectMatch_clip/RS_ReprojectMatch_clip.svg" />

## Signatures

```sql theme={"system"}
RS_ReprojectMatch (raster: Raster, reference: Raster, algorithm: String)
```

## Parameters

<ParamField body="raster" type="Raster" required>
  The input raster.
</ParamField>

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

<ParamField body="algorithm" type="String" required>
  The algorithm value.
</ParamField>

## Return type

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

## Example

```sql theme={"system"}
WITH t AS (
    SELECT RS_MapAlgebra(RS_MakeEmptyRaster(1, 500, 500, 308736,4091167, 1000, -1000, 0, 0, 32611), 'D', 'out = sin(x() * 0.2);') rast1,
        RS_MapAlgebra(RS_MakeEmptyRaster(1, 500, 500, 16536,4185970, 1000, -1000, 0, 0, 32612), 'D', 'out = sin(y() * 0.2);') rast2
) SELECT t.rast1, t.rast2, RS_ReprojectMatch(rast1, rast2) rast12, RS_ReprojectMatch(rast2, rast1) rast21 FROM t
```
