How do i transform a geometry to a new geometry with a crs like urn:ogc:def:crs:EPSG::25832

st_transform(geom,integer srid) obviously doesn't work since my srid is a string

found a solution

  • Your solution only works if the crs is already listed in spatial_ref_sys table. ST_Transform(geom,25832) would be the same. – AndreJ Apr 7 '14 at 14:43
  • 1
    Welcome to GIS.SE. It's good to solve your own problems, and best for all of us if you post the solution as an Answer, not in the Q. – Martin F Apr 7 '14 at 17:08

You have to enter the CRS definition into the spatial_ref_sys table of postgis, giving it a unique SRID. Then you can use that in all functions.

Usually, all EPSG codes are already in there.

  • thx but im developing a REST service to transform geometrys and since the crs is a user input i dont want to add a bunch of custom crs definitions – thegrouch Apr 7 '14 at 12:40
  • @thegrouch -- It's also best if you edit the new requirements/info (user inputs CRS) into the question. – Martin F Apr 7 '14 at 17:11
  • Is it a recommended way to add support for new CRS definitions - adding them manually to spatial_ref_sys table? – jayarjo Nov 8 '20 at 6:13

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.