[postgis-tickets] [PostGIS] #5232: Coordinates swapping with ST_transform and SRID 3116, postgis 3.1

PostGIS trac at osgeo.org
Sun Sep 4 07:09:30 PDT 2022


#5232: Coordinates swapping with ST_transform and SRID 3116, postgis 3.1
----------------------+---------------------------
 Reporter:  marbotte  |      Owner:  pramsey
     Type:  defect    |     Status:  new
 Priority:  medium    |  Milestone:  PostGIS 3.3.1
Component:  postgis   |    Version:  3.2.x
 Keywords:            |
----------------------+---------------------------
 It seems that the c function associated with ST_Transform(geom,3116) swaps
 X and Y coordinates. I am not sure it concerns only the Magna-Sirgas
 SRIDs, but other random SRIDs did not result in the same bug, all the
 Magna Sirgas in meter are concerned though.
 This bug does not concern the form ST_transform(geom,'proj4text'), which
 seem to use another source function.

 So when I use the following code:

 {{{
 WITH a AS(
 SELECT
   ST_Transform(
     ST_SetSRID(
       ST_MakePoint(-73.84, 7.33)
     ,4326)
   ,3116 ) geom
 ), b AS(
 SELECT
   ST_Transform(
     ST_SetSRID(
       ST_MakePoint(-73.84, 7.33)
     ,4326)
   ,(SELECT proj4text FROM spatial_ref_sys WHERE srid=3116) ) geom
 )
 SELECT ST_X(geom), ST_Y(geom)
 FROM a
 UNION ALL
 SELECT ST_X(geom), ST_Y(geom)
 FROM b
 }}}

 {{{
         st_x        |        st_y
 --------------------+--------------------
  1302328.1712723123 | 1026224.6948008615
  1026224.6948008615 | 1302328.1712723123
 }}}

 My installation:

 {{{
 SELECT postgis_full_version();
 }}}

 POSTGIS="3.1.3 008d2db" [EXTENSION] PGSQL="130" GEOS="3.10.2-CAPI-1.16.0"
 PROJ="8.2.1" LIBXML="2.9.14" LIBJSON="0.16" LIBPROTOBUF="1.4.1"
 WAGYU="0.5.0 (Internal)"

 {{{
 SELECT version()
 }}}
 PostgreSQL 13.8 on x86_64-pc-linux-gnu, compiled by x86_64-pc-linux-gnu-
 gcc (Gentoo 11.3.0 p4) 11.3.0, 64-bit
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5232>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list