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

Returns the coordinate reference system (CRS) of a raster as a string in the specified format. If no format is specified, the CRS is returned in PROJJSON format. Returns null if the raster has no CRS defined.

## Signatures

```sql theme={"system"}
RS_CRS (raster: Raster)
```

```sql theme={"system"}
RS_CRS (raster: Raster, format: String)
```

## Parameters

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

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

## Return type

<ResponseField type="String">
  A string representation.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT RS_CRS(raster) FROM raster_table
```

```json theme={"system"}
{
  "$schema": "https://proj.org/schemas/v0.7/projjson.schema.json",
  "type": "GeographicCRS",
  "name": "WGS 84",
  ...
}
```

Getting CRS in WKT1 format:

```sql theme={"system"}
SELECT RS_CRS(raster, 'wkt1') FROM raster_table
```

```
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
```

Getting CRS in PROJ string format:

```sql theme={"system"}
SELECT RS_CRS(raster, 'proj') FROM raster_table
```

```
+proj=longlat +datum=WGS84 +no_defs +type=crs
```

Getting CRS in WKT2 format:

```sql theme={"system"}
SELECT RS_CRS(raster, 'wkt2') FROM raster_table
```

## Limitations

The `wkt2`, `proj`, and `projjson` output formats are generated by [proj4sedona](https://github.com/jiayuasu/proj4sedona) from the raster's internal WKT1 CRS. This conversion may cause the following limitations:

* **Unsupported projection types**: Some projection types (e.g., Krovak, Hotine Oblique Mercator) cannot be exported to `wkt2`, `proj`, or `projjson` formats and will throw an error. Use `'wkt1'` format for these.

<Note>
  `RS_CRS` returns null only when the raster has no CRS defined. Note that `RS_SRID` may return `0` either when no CRS is defined or when a custom (non-EPSG) CRS has been set via `RS_SetCRS`, so `RS_SRID = 0` does not always mean "no CRS". To test for a missing CRS, use `RS_CRS(raster) IS NULL`. The `wkt1` format always produces a lossless representation of the internally stored CRS.
</Note>
