[postgis-tickets] r15107 - #3569, Incorrect coordinates returned by ST_CollectionHomogenize

Daniel Baston dbaston at gmail.com
Tue Sep 13 12:14:05 PDT 2016


Author: dbaston
Date: 2016-09-13 12:14:05 -0700 (Tue, 13 Sep 2016)
New Revision: 15107

Modified:
   branches/2.2/NEWS
   branches/2.2/liblwgeom/liblwgeom.h.in
   branches/2.2/postgis/lwgeom_functions_basic.c
   branches/2.2/regress/tickets.sql
   branches/2.2/regress/tickets_expected
Log:
#3569, Incorrect coordinates returned by ST_CollectionHomogenize

Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2016-09-13 19:09:17 UTC (rev 15106)
+++ branches/2.2/NEWS	2016-09-13 19:14:05 UTC (rev 15107)
@@ -14,6 +14,8 @@
   - #3573, Operator <<->> incorrectly calculates m distance
   - #3579, Crash in LWGEOM2GEOS
   - #3515, tiger_data not being backed up
+  - #3569, Incorrect coordinates returned by ST_CollectionHomogenize
+           (Dan Baston)
   - #3602, perl as found by configure is not used 
            in tiger extension, postgis_sfcgal, address_standardizer  
   - #3607, Fix inconsistency with multilinestring in

Modified: branches/2.2/liblwgeom/liblwgeom.h.in
===================================================================
--- branches/2.2/liblwgeom/liblwgeom.h.in	2016-09-13 19:09:17 UTC (rev 15106)
+++ branches/2.2/liblwgeom/liblwgeom.h.in	2016-09-13 19:14:05 UTC (rev 15107)
@@ -1027,7 +1027,12 @@
 
 extern int lwcollection_ngeoms(const LWCOLLECTION *col);
 
-/* Given a generic geometry/collection, return the "simplest" form. */
+/* Given a generic geometry/collection, return the "simplest" form.
+ * The elements of the homogenized collection are references to the
+ * input geometry; a deep clone is not performed.
+ * TODO: consider returning a geometry that does not reference the
+ * input
+ * */
 extern LWGEOM *lwgeom_homogenize(const LWGEOM *geom);
 
 

Modified: branches/2.2/postgis/lwgeom_functions_basic.c
===================================================================
--- branches/2.2/postgis/lwgeom_functions_basic.c	2016-09-13 19:09:17 UTC (rev 15106)
+++ branches/2.2/postgis/lwgeom_functions_basic.c	2016-09-13 19:14:05 UTC (rev 15107)
@@ -2584,14 +2584,17 @@
 
 	lwoutput = lwgeom_homogenize(lwgeom);
 	lwgeom_free(lwgeom);
-	PG_FREE_IF_COPY(input, 0);
 
 	if ( ! lwoutput )
+	{
 		PG_RETURN_NULL();
+		PG_FREE_IF_COPY(input, 0);
+	}
 
 	output = geometry_serialize(lwoutput);
 	lwgeom_free(lwoutput);
 
+	PG_FREE_IF_COPY(input, 0);
 	PG_RETURN_POINTER(output);
 }
 

Modified: branches/2.2/regress/tickets.sql
===================================================================
--- branches/2.2/regress/tickets.sql	2016-09-13 19:09:17 UTC (rev 15106)
+++ branches/2.2/regress/tickets.sql	2016-09-13 19:14:05 UTC (rev 15107)
@@ -950,6 +950,13 @@
 -- #3565
 SELECT '#3565',ST_SetPoint(st_geomfromtext('LINESTRING EMPTY'), 0, ST_MakePoint(1,1));
 
+-- #3569
+WITH clustr AS (
+      SELECT ST_Polygonize(ST_MakeEnvelope(1, 2, 3, 4)) AS geom
+    )
+    SELECT '#3569', ST_CollectionHomogenize(geom)::box2d
+    FROM clustr;
+
 -- #3579
 with
         params as (

Modified: branches/2.2/regress/tickets_expected
===================================================================
--- branches/2.2/regress/tickets_expected	2016-09-13 19:09:17 UTC (rev 15106)
+++ branches/2.2/regress/tickets_expected	2016-09-13 19:14:05 UTC (rev 15107)
@@ -292,6 +292,7 @@
 #3470|t
 #3470b|50
 ERROR:  Cannot set point values on EMPTY geometry, use ST_AddPoint to add points
+#3569|BOX(1 2,3 4)
 #3579|f|t
 #3583|MULTIPOLYGON Z (EMPTY)
 #3627a|o}~~|AdshNoSsBgd at eGoBlm@wKhj@~@?



More information about the postgis-tickets mailing list