Skip to main content
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

RS_CRS (raster: Raster)
RS_CRS (raster: Raster, format: String)

Parameters

raster
Raster
required
The input raster.
format
String
The format value.

Return type

A string representation.

Examples

SELECT RS_CRS(raster) FROM raster_table
{
  "$schema": "https://proj.org/schemas/v0.7/projjson.schema.json",
  "type": "GeographicCRS",
  "name": "WGS 84",
  ...
}
Getting CRS in WKT1 format:
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:
SELECT RS_CRS(raster, 'proj') FROM raster_table
+proj=longlat +datum=WGS84 +no_defs +type=crs
Getting CRS in WKT2 format:
SELECT RS_CRS(raster, 'wkt2') FROM raster_table

Limitations

The wkt2, proj, and projjson output formats are generated by 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.
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.