[postgis-tickets] r17789 - Fix ST_Simplify output having an outdated bbox

Raul raul at rmr.ninja
Thu Aug 29 08:24:10 PDT 2019


Author: algunenano
Date: 2019-08-29 08:24:10 -0700 (Thu, 29 Aug 2019)
New Revision: 17789

Modified:
   branches/2.3/NEWS
   branches/2.3/postgis/lwgeom_functions_analytic.c
   branches/2.3/regress/simplify.sql
   branches/2.3/regress/simplify_expected
Log:
Fix ST_Simplify output having an outdated bbox

Closes #4494
Closes https://github.com/postgis/postgis/pull/470


Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2019-08-29 15:23:11 UTC (rev 17788)
+++ branches/2.3/NEWS	2019-08-29 15:24:10 UTC (rev 17789)
@@ -5,6 +5,7 @@
 
   - #4475, Avoid reading into empty ptarray (Paul Ramsey)
   - #4492, Fix ST_Simplify ignoring the value of the 3rd parameter (Raúl Marín)
+  - #4494, Fix ST_Simplify output having an outdated bbox (Raúl Marín)
 
 PostGIS 2.3.10
 2019/08/11

Modified: branches/2.3/postgis/lwgeom_functions_analytic.c
===================================================================
--- branches/2.3/postgis/lwgeom_functions_analytic.c	2019-08-29 15:23:11 UTC (rev 17788)
+++ branches/2.3/postgis/lwgeom_functions_analytic.c	2019-08-29 15:24:10 UTC (rev 17789)
@@ -87,7 +87,8 @@
 	if ( ! out ) PG_RETURN_NULL();
 
 	/* COMPUTE_BBOX TAINTING */
-	if ( in->bbox ) lwgeom_add_bbox(out);
+	if (in->bbox)
+		lwgeom_refresh_bbox(out);
 
 	result = geometry_serialize(out);
 	lwgeom_free(out);

Modified: branches/2.3/regress/simplify.sql
===================================================================
--- branches/2.3/regress/simplify.sql	2019-08-29 15:23:11 UTC (rev 17788)
+++ branches/2.3/regress/simplify.sql	2019-08-29 15:24:10 UTC (rev 17789)
@@ -14,4 +14,11 @@
 SELECT '12', ST_astext(ST_Simplify('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)),((100 100, 100 130, 130 130, 130 100, 100 100)))', 20));
 
 SELECT '13', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, false));
-SELECT '14', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, true));
\ No newline at end of file
+SELECT '14', ST_astext(ST_Simplify('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 20, true));
+
+-- Updates the geometry bbox
+WITH geom AS
+(
+    SELECT ST_Simplify('POLYGON((0 0, 10 0, 10 10, 10.6 10, 10.5 10.5, 10 10, 0 10, 0 0))', 1) as g
+)
+Select '15', ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;
\ No newline at end of file

Modified: branches/2.3/regress/simplify_expected
===================================================================
--- branches/2.3/regress/simplify_expected	2019-08-29 15:23:11 UTC (rev 17788)
+++ branches/2.3/regress/simplify_expected	2019-08-29 15:24:10 UTC (rev 17789)
@@ -12,3 +12,4 @@
 12|MULTIPOLYGON(((100 100,100 130,130 130,130 100,100 100)))
 13|
 14|POLYGON((0 0,10 0,10 10,0 0))
+15|POLYGON((0 0,10 0,10.5 10.5,0 10,0 0))|BOX(0 0,10.5 10.5)



More information about the postgis-tickets mailing list