2

I would like to use proj pipeline in PostGIS ST_Transform function.

My sample SRS is as follows:

+proj=pipeline +step +inv +proj=unitconvert +xy_in=m +xy_out=us-ft +z_in=m +z_out=us-ft +step +inv +proj=affine +s31=0.0001114681107 +s32=-4.9243526e-06 +zoff=-204.82041421671258 +step +inv +proj=helmert +s=1.0 +theta=1260.81751160268 +x=-4937.257377537489 +y=11286.424894191185 +exact +convention=coordinate_frame +step +inv +proj=tmerc +a=20925604.474167 +axis=enu +k_0=1.0 +lat_0=40.564968481372 +lon_0=-112.06247332686 +rf=0.0033528106718306487 +x_0=1843937.2703695 +y_0=813356.04485812 +step +proj=cart +a=20925604.474167 +rf=0.0033528106718306487 +step +inv +proj=cart +a=6378137.0 +rf=298.2572229329577 +step +inv +proj=vgridshift +grids=g2012bu0.gtx +step +inv +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=axisswap +order=2,1

I get the following error with ST_Transform:

ERROR: transform_geom: could not parse proj4 string '+proj=pipeline +step +inv +proj=unitconvert +xy_in=m +xy_out=us-ft +z_in=m +z_out=us-ft +step +inv +proj=affine +s31=0.0001114681107 +s32=-4.9243526e-06 +zoff=-204.82041421671258 +step +inv +proj=helmert +s=1.0 +theta=1260.81751160268 +x=-4937.257377537489 +y=11286.424894191185 +exact +convention=coordinate_frame +step +inv +proj=tmerc +a=20925604.474167 +axis=enu +k_0=1.0 +lat_0=40.564968481372 +lon_0=-112.06247332686 +rf=0.0033528106718306487 +x_0=1843937.2703695 +y_0=813356.04485812 +step +proj=cart +a=20925604.474167 +rf=0.0033528106718306487 +step +inv +proj=cart +a=6378137.0 +rf=298.2572229329577 +step +inv +proj=vgridshift +grids=g2012bu0.gtx +step +inv +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=axisswap +order=2,1' squared eccentricity < 0

1 Answer 1

0

It is not possible yet to define a transformation with a Proj pipeline but it should be easy once the new function ST_TransformPipeline is ready. Follow the situation of this ticket https://trac.osgeo.org/postgis/ticket/5006 "ST_Transform: Support PROJ pipelines"

Answer is based on this PostGIS version:

"POSTGIS="3.1.2 3.1.2" [EXTENSION] PGSQL="120" GEOS="3.9.1-CAPI-1.14.1" PROJ="7.1.1" GDAL="GDAL 3.2.3, released 2021/04/27 GDAL_DATA not found" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" RASTER"

8
  • This is not completely true as I'm able to execute the following query successfully.SELECT ST_AsText(ST_Transform(ST_Point(97168.985189,92179.519409), '+proj=pipeline +step +proj=tmerc +lat_0=42.859558783333 +lon_0=-111.39915361388 +k_0=1.0 +a=6378137.0000001015 +b=6356752.314200101 +x_0=874.9606299203758 +y_0=9787.440182870307 +towgs84=0.0,0.0,0.0 +units=m +no_defs +step +proj=helmert +s=1 +theta=153191.535399821 +x=-6387.74752364828 +y=3167.65884817593 +exact +convention=coordinate_frame', 3857)) Commented Mar 18, 2022 at 15:07
  • I now have the challenge of how to achieve the same in WKT of the above proj pipeline as spatial_ref_sys table entry is not helping to transform the value Commented Mar 18, 2022 at 15:10
  • What versions do you have? Your query gives me ERROR: lwgeom_transform_from_str: Failed to transform CONTEXT: SQL function "st_transform" statement 1. I have "POSTGIS="3.1.2 3.1.2" [EXTENSION] PGSQL="120" GEOS="3.9.1-CAPI-1.14.1" PROJ="7.1.1" GDAL="GDAL 3.2.3, released 2021/04/27 GDAL_DATA not found" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" RASTER"
    – user30184
    Commented Mar 18, 2022 at 15:11
  • PostgreSQL 11.9 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-gcc (GCC) 7.4.0, 64-bit, POSTGIS="2.5.2" [EXTENSION] PGSQL="110" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 6.2.1, November 1st, 2019" GDAL="GDAL 2.3.1, released 2018/06/22" LIBXML="2.9.9" LIBJSON="0.12.99" LIBPROTOBUF="1.3.0" RASTER Commented Mar 18, 2022 at 15:13
  • Odd. I copied your query as-is and it does not work for me even I seem to have newer versions.
    – user30184
    Commented Mar 18, 2022 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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