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

Parameters

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

Return type

A string representation.

Examples

Getting CRS in WKT1 format:
Getting CRS in PROJ string format:
Getting CRS in WKT2 format:

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.