[postgis-tickets] r17784 - Fix ST_Simplify ignoring the value of the 3rd parameter

Raul raul at rmr.ninja
Thu Aug 29 04:54:23 PDT 2019


Author: algunenano
Date: 2019-08-29 04:54:22 -0700 (Thu, 29 Aug 2019)
New Revision: 17784

Modified:
   branches/2.4/NEWS
   branches/2.4/postgis/lwgeom_functions_analytic.c
   branches/2.4/regress/simplify.sql
   branches/2.4/regress/simplify_expected
Log:
Fix ST_Simplify ignoring the value of the 3rd parameter

References #4492



Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2019-08-29 11:53:11 UTC (rev 17783)
+++ branches/2.4/NEWS	2019-08-29 11:54:22 UTC (rev 17784)
@@ -1,3 +1,11 @@
+PostGIS 2.4.9
+XXXX/XX/XX
+
+  * Bug Fixes and Enhancements *
+
+  - #4492, Fix ST_Simplify ignoring the value of the 3rd parameter (Raúl Marín)
+
+
 PostGIS 2.4.8
 2019/08/11
 

Modified: branches/2.4/postgis/lwgeom_functions_analytic.c
===================================================================
--- branches/2.4/postgis/lwgeom_functions_analytic.c	2019-08-29 11:53:11 UTC (rev 17783)
+++ branches/2.4/postgis/lwgeom_functions_analytic.c	2019-08-29 11:54:22 UTC (rev 17784)
@@ -73,8 +73,8 @@
 	bool preserve_collapsed = false;
 
 	/* Handle optional argument to preserve collapsed features */
-	if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
-		preserve_collapsed = true;
+	if ((PG_NARGS() > 2) && (!PG_ARGISNULL(2)))
+		preserve_collapsed = PG_GETARG_BOOL(2);
 
 	/* Can't simplify points! */
 	if ( type == POINTTYPE || type == MULTIPOINTTYPE )

Modified: branches/2.4/regress/simplify.sql
===================================================================
--- branches/2.4/regress/simplify.sql	2019-08-29 11:53:11 UTC (rev 17783)
+++ branches/2.4/regress/simplify.sql	2019-08-29 11:54:22 UTC (rev 17784)
@@ -12,3 +12,6 @@
 SELECT '10', ST_astext(ST_Simplify('LINESTRING(0 0, 0 10)', 20));
 SELECT '11', ST_astext(ST_Simplify('MULTIPOLYGON(((100 100, 100 130, 130 130, 130 100, 100 100)), ((0 0, 10 0, 10 10, 0 10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)) )', 20));
 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

Modified: branches/2.4/regress/simplify_expected
===================================================================
--- branches/2.4/regress/simplify_expected	2019-08-29 11:53:11 UTC (rev 17783)
+++ branches/2.4/regress/simplify_expected	2019-08-29 11:54:22 UTC (rev 17784)
@@ -10,3 +10,5 @@
 10|LINESTRING(0 0,0 10)
 11|MULTIPOLYGON(((100 100,100 130,130 130,130 100,100 100)))
 12|MULTIPOLYGON(((100 100,100 130,130 130,130 100,100 100)))
+13|
+14|POLYGON((0 0,10 0,10 10,0 0))



More information about the postgis-tickets mailing list