From bc47761f480e0015cab534ab6cd14d57973f88b2 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 15 Feb 2012 15:59:52 +0000 Subject: [PATCH] Do not take PROJ4 errno value as a sign of error (#1580) git-svn-id: http://svn.osgeo.org/postgis/trunk@9194 b70326c6-7e19-0410-871a-916f4a2858ee --- libpgcommon/lwgeom_transform.c | 11 ++++------- regress/tickets.sql | 5 +++++ regress/tickets_expected | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 07bba1811..9cd777801 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -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())); } /* diff --git a/regress/tickets.sql b/regress/tickets.sql index ba3783d42..38ebb9d5e 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -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; diff --git a/regress/tickets_expected b/regress/tickets_expected index e071f5e56..e23cd97be 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -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] -- 2.40.0