]> granicus.if.org Git - postgis/commitdiff
Avoid a call to the GEOS CAPI when unnecessary (works around a bug in GEOS aborting...
authorSandro Santilli <strk@keybit.net>
Sun, 28 Feb 2010 19:04:08 +0000 (19:04 +0000)
committerSandro Santilli <strk@keybit.net>
Sun, 28 Feb 2010 19:04:08 +0000 (19:04 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5353 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos.c

index be0eac1c540d8cc5b666caf962fb4ce0c03c9a54..99fb96b090846084cee9ab1ad7d7b378535d0398 100644 (file)
@@ -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");