[postgis-tickets] r15364 - ST_Subdivide loses subparts of inverted geometries patch from Darafei Praliaskouski (Komzpa)
Regina Obe
lr at pcorp.us
Mon Apr 24 13:42:05 PDT 2017
Author: robe
Date: 2017-04-24 13:42:05 -0700 (Mon, 24 Apr 2017)
New Revision: 15364
Modified:
branches/2.3/NEWS
branches/2.3/liblwgeom/lwgeom.c
branches/2.3/regress/subdivide.sql
branches/2.3/regress/subdivide_expected
Log:
ST_Subdivide loses subparts of inverted geometries patch from Darafei Praliaskouski (Komzpa)
Closes #3744 for PostGIS 2.3
changed area regress to cast to numeric so doesn't return scientific notation on windows
Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS 2017-04-24 18:01:43 UTC (rev 15363)
+++ branches/2.3/NEWS 2017-04-24 20:42:05 UTC (rev 15364)
@@ -6,6 +6,8 @@
- #3711, Azimuth error upon adding 2.5D edges to topology
- #3738, raster: Using -s without -Y in raster2pgsql transforms
raster data instead of setting srid
+ - #3744, ST_Subdivide loses subparts of inverted geometries
+ (Darafei Praliaskouski Komzpa)
PostGIS 2.3.2
2017/01/31
Modified: branches/2.3/liblwgeom/lwgeom.c
===================================================================
--- branches/2.3/liblwgeom/lwgeom.c 2017-04-24 18:01:43 UTC (rev 15363)
+++ branches/2.3/liblwgeom/lwgeom.c 2017-04-24 20:42:05 UTC (rev 15364)
@@ -1950,11 +1950,11 @@
return n;
}
- /* But don't go too far. 2^25 = 33M, that's enough subdivision */
- /* Signal callers above that we depth'ed out with a negative */
- /* return value */
+ /* But don't go too far. 2^50 ~= 10^15, that's enough subdivision */
+ /* Just add what's left */
if ( depth > maxdepth )
{
+ lwcollection_add_lwgeom(col, lwgeom_clone_deep(geom));
return 0;
}
@@ -2001,15 +2001,17 @@
clipped1 = lwgeom_clip_by_rect(geom, subbox1.xmin, subbox1.ymin, subbox1.xmax, subbox1.ymax);
clipped2 = lwgeom_clip_by_rect(geom, subbox2.xmin, subbox2.ymin, subbox2.xmax, subbox2.ymax);
+ ++depth;
+
if ( clipped1 )
{
- n += lwgeom_subdivide_recursive(clipped1, maxvertices, ++depth, col, &subbox1);
+ n += lwgeom_subdivide_recursive(clipped1, maxvertices, depth, col, &subbox1);
lwgeom_free(clipped1);
}
if ( clipped2 )
{
- n += lwgeom_subdivide_recursive(clipped2, maxvertices, ++depth, col, &subbox2);
+ n += lwgeom_subdivide_recursive(clipped2, maxvertices, depth, col, &subbox2);
lwgeom_free(clipped2);
}
Modified: branches/2.3/regress/subdivide.sql
===================================================================
--- branches/2.3/regress/subdivide.sql 2017-04-24 18:01:43 UTC (rev 15363)
+++ branches/2.3/regress/subdivide.sql 2017-04-24 20:42:05 UTC (rev 15364)
@@ -24,3 +24,20 @@
GROUP BY gs.full_area;
SELECT '#3522', ST_AsText(ST_Subdivide(ST_GeomFromText('POINT(1 1)',4326),10));
+
+
+with inverted_geom as (
+ select ST_Difference(
+ ST_Expand('SRID=3857;POINT(0 0)' :: geometry, 20000000),
+ ST_Buffer(
+ 'SRID=3857;POINT(0 0)' :: geometry,
+ 1,
+ 1000
+ )
+ ) as geom
+)
+select 'https://github.com/postgis/postgis/pull/127', ST_Area(ST_Simplify(ST_Union(geom), 2))::numeric
+from (
+ select ST_Subdivide(geom) geom
+ from inverted_geom
+ ) z;
Modified: branches/2.3/regress/subdivide_expected
===================================================================
--- branches/2.3/regress/subdivide_expected 2017-04-24 18:01:43 UTC (rev 15363)
+++ branches/2.3/regress/subdivide_expected 2017-04-24 20:42:05 UTC (rev 15364)
@@ -2,3 +2,4 @@
2|t|6|7
3|t|15|9
#3522|POINT(1 1)
+https://github.com/postgis/postgis/pull/127|1600000000000000
More information about the postgis-tickets
mailing list