]> granicus.if.org Git - postgis/commitdiff
ST_Subdivide: support rect hole in rect shell
authorDarafei Praliaskouski <me@komzpa.net>
Mon, 22 Oct 2018 15:26:49 +0000 (15:26 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Mon, 22 Oct 2018 15:26:49 +0000 (15:26 +0000)
Closes #4211
Closes https://github.com/postgis/postgis/pull/317

git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@16938 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwgeom.c
regress/subdivide.sql
regress/subdivide_expected

diff --git a/NEWS b/NEWS
index 3461121fbb8e8e688873b5bc1e1fb05cbf642ccb..a7bd03ebd42b046a7e5068952e553f61bc54b4d6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,8 @@ XXXX/XX/XX
   - #4191, Fix undefined behaviour in ptarray_clone_deep (Raúl Marín)
   - #4020, Fix leftovers in topology upgrade from 2.1 (Sandro Santilli)
   - #4206, Fix support for PostgreSQL 12 dev branch (Laurenz Albe)
-
+  - #4211, Fix ST_Subdivide for minimal exterior ring with minimal hole (Darafei
+    Praliaskouski)
 
 PostGIS 2.5.0
 2018/09/23
index d582f02da180ee0ac709646ff9e8f303bbcd55c9..1d87e3a858d3873ee932cdc1921a4c7a94a83f75 100644 (file)
@@ -2353,7 +2353,7 @@ lwgeom_subdivide_recursive(const LWGEOM *geom, uint8_t dimension, uint32_t maxve
                lwpoly = (LWPOLY *)geom;
 
                /* if there are more points in holes than in outer ring */
-               if (nvertices > 2 * lwpoly->rings[0]->npoints)
+               if (nvertices >= 2 * lwpoly->rings[0]->npoints)
                {
                        /* trim holes starting from biggest */
                        for (i = 1; i < lwpoly->nrings; i++)
index 1a1f774a7993bf7309f219b9435ca31ad9ba2e47..c35be87e3217011229dcd7791db999945eaaae0a 100644 (file)
@@ -58,3 +58,5 @@ FROM big_polygon_sliced gs;
 
 drop table big_polygon;
 drop table big_polygon_sliced;
+
+select '#4211', (select sum(ST_Area(geom))::numeric(12,11) from ST_Subdivide('MULTIPOLYGON(((-88.2059 41.7325,-88.2060 41.7244,-88.1959 41.7241,-88.1959 41.7326,-88.2059 41.7325),(-88.1997 41.7289,-88.1996 41.7285,-88.1990 41.7285,-88.1990 41.7289,-88.1997 41.7289)))') geom );
index 1740a93a03d75296dcef5c2ceee87205288d8851..dc21493ad5195c98f0fe8673ba006513e7ec0850 100644 (file)
@@ -5,3 +5,4 @@ ERROR:  lwgeom_subdivide: cannot subdivide to fewer than 5 vertices per output
 #3522|POINT(1 1)
 #3744|1600000000000000
 4|29321996468.6|29321996468.6|1857|256
+#4211|0.00008316000