]> granicus.if.org Git - postgis/commitdiff
Do not drop collapsed polygon shells (#1698)
authorSandro Santilli <strk@keybit.net>
Thu, 22 Mar 2012 15:06:52 +0000 (15:06 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 22 Mar 2012 15:06:52 +0000 (15:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9527 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwpoly.c

index 08d55841be0e02112bc9e52223f54a8e13eb00d2..e73b42293495abcc1009ac9da4b49c471e42f687 100644 (file)
@@ -356,7 +356,7 @@ LWPOLY* lwpoly_simplify(const LWPOLY *ipoly, double dist)
                POINTARRAY *opts = ptarray_simplify(ipoly->rings[i], dist);
 
                /* One point implies an error in the ptarray_simplify */
-               if ( opts->npoints < 2 )
+               if ( i && ( opts->npoints < 2 ) )
                {
                        LWDEBUG(2, "ptarray_simplify returned a <2 pts array");
                        ptarray_free(opts);
@@ -364,7 +364,7 @@ LWPOLY* lwpoly_simplify(const LWPOLY *ipoly, double dist)
                }
 
                /* Less points than are needed to form a closed ring, we can't use this */
-               if ( opts->npoints < 4 )
+               if ( i && ( opts->npoints < 4 ) )
                {
                        LWDEBUGF(3, "ring%d skipped (<4 pts)", i);
                        ptarray_free(opts);