Name

ST_AsWKTSRS — Returns the Well-known Text representation of the Spatial Reference System.

Synopsis

varchar ST_AsWKTSRS(integer SRID);

Alias

AsWKTSRS

Description

Returns the Well-known Text representation of the Spatial Reference System.

This function searches the field SRTEXT in the Spatial Reference Systems table, which is named SPATIAL_REF_SYS. If the SRID is not found, it returns a warning.

Coordinate Dimensions
2D3DM

-

-

-

Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

--SRID=25830
SELECT ST_AsWKTSRS(25830);

--Result
PROJCS["ETRS89 / UTM zone 30N",
  GEOGCS["ETRS89",
    DATUM["European Terrestrial Reference System 1989",
      SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]],
      TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
      AUTHORITY["EPSG","6258"]],
    PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
    UNIT["degree", 0.017453292519943295],
    AXIS["Geodetic latitude", NORTH],
    AXIS["Geodetic longitude", EAST],
    AUTHORITY["EPSG","4258"]],
  PROJECTION["Transverse Mercator", AUTHORITY["EPSG","9807"]],
  PARAMETER["central_meridian", -3.0],
  PARAMETER["latitude_of_origin", 0.0],
  PARAMETER["scale_factor", 0.9996],
  PARAMETER["false_easting", 500000.0],
  PARAMETER["false_northing", 0.0],
  UNIT["m", 1.0],
  AXIS["Easting", EAST],
  AXIS["Northing", NORTH],
  AUTHORITY["EPSG","25830"]]

--SRID=1 (Not Valid)
SELECT ST_AsWKTSRS(1);

--Result
SRS not supported by GeoTools (1): org.opengis.referencing.
NoSuchAuthorityCodeException: No code "EPSG:1" from authority "European Petroleum Survey Group" 
found for object of type "CoordinateReferenceSystem".

Related functions

Find_SRID