Is there a PostGIS function for obtaining the WKT of an SRID in PostGIS?

By WKT, I mean the ones that can be uploaded to spatialreference.org.

I'm trying to create a new SRID/SRS by tweaking existing SRID/SRS. But couldn't find a way to obtain the WKT. Search results mostly show ST_AsText, which is for converting geometry/geography to WKT.


You should use this request to get the PostGIS WKT srid where srtext is the WKT you are looking for (you can compare it with http://spatialreference.org although nowadays I only use http://epsg.io, a more up to date version)

SELECT srid, auth_name, auth_srid, srtext AS wkt, proj4text
FROM public.spatial_ref_sys
WHERE srid = 2154;

PS: spatial_ref_sys structure/content is documented at https://postgis.net/docs/using_postgis_dbmanagement.html#spatial_ref_sys

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.