From 46c5593cfccaac4bd9c241b089b0c18270216bb0 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Sun, 28 Feb 2010 19:04:08 +0000 Subject: [PATCH] Avoid a call to the GEOS CAPI when unnecessary (works around a bug in GEOS aborting in some cases of EMPTY polygons git-svn-id: http://svn.osgeo.org/postgis/trunk@5353 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/lwgeom_geos.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index be0eac1c5..99fb96b09 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -3324,15 +3324,16 @@ LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d) { int type = GEOSGeomTypeId(geom) ; - bool hasZ = GEOSHasZ(geom); + bool hasZ; int SRID = GEOSGetSRID(geom); /* GEOS's 0 is equivalent to our -1 as for SRID values */ if ( SRID == 0 ) SRID = -1; - if ( ! hasZ ) + if ( want3d ) { - if ( want3d ) + hasZ = GEOSHasZ(geom); + if ( ! hasZ ) { POSTGIS_DEBUG(3, "Geometry has no Z, won't provide one"); -- 2.40.0