[postgis-users] ST_Transform weirdness in 3.1.5

James Klassen klassen.js at gmail.com
Mon Apr 4 10:58:56 PDT 2022


I also cannot reproduce the Infinities in the first query on my installs
with proj 7.2.1 (on amd64 and aarch64).

To answer why transformations with SRID and proj4txt give different
results: I believe the SRID based transformation goes through all the
proj.db magic to select the best transformations between the two CRSes
(including potential datum transforms), while the proj4txt is more limited
and basically just does what proj4 did (often produce answers that are
incorrect, but generally close enough people didn't usually notice).

My guess as to why the SRID version isn't working is a proj6 bug (either in
the code or in the included proj.db), or missing/incorrect datum files.  In
my experience is a lot of weirdness was fixed in proj7 and proj8.



On 4/4/22 12:01, Paul Ramsey wrote:

Not super obvious as I'm not seeing a reproduction here on a more
recent proj. Anyone with proj6 able to reproduce?
P


On Apr 4, 2022, at 9:18 AM, Jeff Hoffmann <jeff at propertykey.com>
<jeff at propertykey.com> wrote:

I am running PostgreSQL via Amazon RDS. Here is the version
information for the instance that exhibits the problem:

                                                  version
-------------------------------------------------------------------------------------------------------------
PostgreSQL 12.8 on aarch64-unknown-linux-gnu, compiled by
aarch64-unknown-linux-gnu-gcc (GCC) 7.4.0, 64-bit
(1 row)

postgis_full_version
---------------------------------------------------------------------------------------------------------------------------------------------------------------
POSTGIS="3.1.5 0" [EXTENSION] PGSQL="120" GEOS="3.8.2-CAPI-1.13.4"
PROJ="6.2.1" LIBXML="2.9.9" LIBJSON="0.12.99" LIBPROTOBUF="1.3.0"
WAGYU="0.5.0 (Internal)"
(1 row)

Here is an example of a query that produces weird results:


select st_asewkt(st_transform('SRID=4269;POLYGON((-81.11425169432798
25.139365690162226,-79.88375846050846
25.135204935817377,-79.8759485474324
25.97511821217247,-81.11505127181294
25.97943803781699,-81.11425169432798 25.139365690162226))'::geometry,
3087));

       st_asewkt
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
SRID=3087;POLYGON((690648.3378382007 129676.3544158864,Infinity
Infinity,Infinity Infinity,688388.1492655604
222840.53520809134,690648.3378382007 129676.3544158864))
(1 row)

Two of the points are coming up as (Infinty,Infinity).  When I run the
same query using the proj4text found in the spatial_ref_sys table
instead of the srid I get the following output:

select st_asewkt(st_transform('SRID=4269;POLYGON((-81.11425169432798
25.139365690162226,-79.88375846050846
25.135204935817377,-79.8759485474324
25.97511821217247,-81.11505127181294
25.97943803781699,-81.11425169432798 25.139365690162226))'::geometry,
'+proj=aea +lat_1=24 +lat_2=31.5 +lat_0=24 +lon_0=-84 +x_0=400000
+y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'));

                    st_asewkt
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POLYGON((690648.3378382007 129676.3544158864,814558.219082916
132733.37665360732,812229.019377012
225881.33726899035,688388.1492655604
222840.53520809134,690648.3378382007 129676.3544158864))
(1 row)

This looks pretty close to right.  What is the disconnect between
using the srid to call the transform vs the proj4text version of
st_transform?

-- 
Jeff Hoffmann
PropertyKeyjeff at propertykey.com
_______________________________________________
postgis-users mailing
listpostgis-users at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing
listpostgis-users at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220404/c0c9a770/attachment.html>


More information about the postgis-users mailing list