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

Sets the coordinate reference system (CRS) of a raster using a CRS definition string. Unlike `RS_SetSRID` which only accepts integer EPSG codes, `RS_SetCRS` accepts CRS definitions in multiple formats including EPSG codes, WKT1, WKT2, PROJ strings, and PROJJSON. This function does not reproject/transform the raster data — it only sets the CRS metadata.

## Signatures

```sql theme={"system"}
RS_SetCRS (raster: Raster, crsString: String)
```

## Parameters

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

<ParamField body="crsString" type="String" required>
  The crs string value.
</ParamField>

## Return type

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

## Examples

```sql theme={"system"}
SELECT RS_SetCRS(raster, 'EPSG:4326') FROM raster_table
```

Setting CRS with a PROJ string (useful for custom projections):

```sql theme={"system"}
SELECT RS_SetCRS(raster, '+proj=lcc +lat_1=25 +lat_2=60 +lat_0=42.5 +lon_0=-100 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs')
FROM raster_table
```

Setting CRS with a WKT1 string:

```sql theme={"system"}
SELECT RS_SetCRS(raster, 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]')
FROM raster_table
```

## Limitations

Internally, Sedona stores raster CRS in WKT1 format (via GeoTools). When you provide a CRS in WKT2, PROJ, or PROJJSON format, it is converted to WKT1 using [proj4sedona](https://github.com/jiayuasu/proj4sedona). This conversion may cause the following limitations:

* **SRID not preserved for projected CRS**: When importing PROJ or PROJJSON strings, the EPSG SRID is often lost for projected coordinate systems. Only geographic CRS (e.g., EPSG:4326), Web Mercator (EPSG:3857), and UTM zones reliably preserve their SRID. Use `RS_SetSRID` after `RS_SetCRS` if you need to set a specific SRID.
* **Unsupported projection types**: Some projection types (e.g., Krovak, Hotine Oblique Mercator) are not supported by proj4sedona and will fail for WKT2, PROJ, and PROJJSON formats. Use `'EPSG:xxxx'` or WKT1 for these.

<Note>
  For the most reliable results, use `'EPSG:xxxx'` format when your CRS has a known EPSG code. WKT1 input is also lossless since it is stored natively. WKT2, PROJ, and PROJJSON inputs undergo conversion and may experience the limitations above.
</Note>
