]> granicus.if.org Git - postgis/commitdiff
Do not take PROJ4 errno value as a sign of error (#1580)
authorSandro Santilli <strk@keybit.net>
Wed, 15 Feb 2012 15:59:52 +0000 (15:59 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 15 Feb 2012 15:59:52 +0000 (15:59 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9194 b70326c6-7e19-0410-871a-916f4a2858ee

libpgcommon/lwgeom_transform.c
regress/tickets.sql
regress/tickets_expected

index 07bba1811cb034b1cf5f5d29ce5557c75d6ef394..9cd7778015752282d7e9ec98b7273a2d7c511006 100644 (file)
@@ -480,7 +480,6 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid)
        MemoryContext PJMemoryContext;
        projPJ projection = NULL;
        char *proj_str;
-       int* pj_errno_ref;
 
        /*
        ** Turn the SRID number into a proj4 string, by reading from spatial_ref_sys
@@ -493,13 +492,11 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid)
        }
 
        projection = lwproj_from_string(proj_str);
-
-       pj_errno_ref = pj_get_errno_ref();
-       if ( (projection == NULL) || (*pj_errno_ref))
+       if ( projection == NULL )
        {
-               /* we need this for error reporting */
-               /*pfree(projection); */
-               elog(ERROR, "AddToPROJ4SRSCache: couldn't parse proj4 string: '%s': %s", proj_str, pj_strerrno(*pj_errno_ref));
+         elog(ERROR,
+           "AddToPROJ4SRSCache: couldn't parse proj4 string: '%s': %s",
+           proj_str, pj_strerrno(*pj_get_errno_ref()));
        }
 
        /*
index ba3783d42e5a084e4d66b568eb1346d6f6fdda64..38ebb9d5ebfce52fa5cad47b8020144cfc463375 100644 (file)
@@ -603,6 +603,11 @@ with inp as (
 )
 select '#1578', _st_within(p, mp), _st_intersects(p, mp) FROM inp;
 
+-- #1580
+select '#1580.1', ST_Summary(ST_Transform('SRID=4326;POINT(0 0)'::geometry, 3395));
+select '#1580.2', ST_Transform('SRID=4326;POINT(180 90)'::geometry, 3395); -- fails
+select '#1580.3', ST_Summary(ST_Transform('SRID=4326;POINT(0 0)'::geometry, 3395));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
 
index e071f5e566eaed76567a98f00304d56451244495..e23cd97bed89f62269d8c70e130b632cdf484b1d 100644 (file)
@@ -198,3 +198,6 @@ ERROR:  AddToPROJ4SRSCache: couldn't parse proj4 string: '': (null)
 #1398b|POINT(-160.137654 77.091608)
 #1543|MULTILINESTRING((0 0,10 0,10 10,0 0),(0 0))|POLYGON((0 0,10 10,10 0,0 0))
 #1578|f|f
+#1580.1|Point[B]
+ERROR:  transform: couldn't project point (180 90 0): tolerance condition error (-20)
+#1580.3|Point[B]