[postgis-tickets] r17793 - Fix ST_RemoveRepeatedPoints output having an outdated bbox

Raul raul at rmr.ninja
Fri Aug 30 06:31:10 PDT 2019


Author: algunenano
Date: 2019-08-30 06:31:10 -0700 (Fri, 30 Aug 2019)
New Revision: 17793

Modified:
   trunk/NEWS
   trunk/postgis/lwgeom_functions_basic.c
   trunk/regress/core/remove_repeated_points.sql
   trunk/regress/core/remove_repeated_points_expected
Log:
Fix ST_RemoveRepeatedPoints output having an outdated bbox

References #4493
Closes https://github.com/postgis/postgis/pull/472



Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2019-08-30 10:35:13 UTC (rev 17792)
+++ trunk/NEWS	2019-08-30 13:31:10 UTC (rev 17793)
@@ -7,6 +7,7 @@
 * Major highlights *
   - #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)
+  - #4493, Fix ST_RemoveRepeatedPoints output having an outdated bbox (Raúl Marín)
 
 PostGIS 3.0.0alpha4
 2019/08/10

Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c	2019-08-30 10:35:13 UTC (rev 17792)
+++ trunk/postgis/lwgeom_functions_basic.c	2019-08-30 13:31:10 UTC (rev 17793)
@@ -2764,6 +2764,11 @@
 
 	lwgeom_in = lwgeom_from_gserialized(g_in);
 	lwgeom_out = lwgeom_remove_repeated_points(lwgeom_in, tolerance);
+
+	/* COMPUTE_BBOX TAINTING */
+	if (lwgeom_in->bbox)
+		lwgeom_refresh_bbox(lwgeom_out);
+
 	g_out = geometry_serialize(lwgeom_out);
 
 	if (lwgeom_out != lwgeom_in)

Modified: trunk/regress/core/remove_repeated_points.sql
===================================================================
--- trunk/regress/core/remove_repeated_points.sql	2019-08-30 10:35:13 UTC (rev 17792)
+++ trunk/regress/core/remove_repeated_points.sql	2019-08-30 13:31:10 UTC (rev 17793)
@@ -29,3 +29,9 @@
 SELECT 17, ST_AsText(ST_RemoveRepeatedPoints('MULTIPOINT(0 0, 0 0, 1 1, 4 4)'::geometry,2));
 SELECT 18, ST_AsText(ST_RemoveRepeatedPoints('POLYGON((-215922 5325694,-218080 5321866,-218693 5322119,-216112 5325812,-215922 5325694))'::geometry, 10000));
 
+-- Updates the ouput bbox
+WITH geom AS
+(
+    SELECT ST_RemoveRepeatedPoints('POLYGON((0 0, 10 0, 10 10, 10.5 10.5, 10 10, 0 10, 0 0))', 1) as g
+)
+Select 19, ST_AsText(g) as geometry, postgis_getbbox(g) AS box from geom;

Modified: trunk/regress/core/remove_repeated_points_expected
===================================================================
--- trunk/regress/core/remove_repeated_points_expected	2019-08-30 10:35:13 UTC (rev 17792)
+++ trunk/regress/core/remove_repeated_points_expected	2019-08-30 13:31:10 UTC (rev 17793)
@@ -17,3 +17,4 @@
 16|MULTIPOINT(0 0,1 1,2 2)
 17|MULTIPOINT(0 0,4 4)
 18|POLYGON((-215922 5325694,-218693 5322119,-216112 5325812,-215922 5325694))
+19|POLYGON((0 0,10 0,10 10,0 10,0 0))|BOX(0 0,10 10)



More information about the postgis-tickets mailing list