[postgis-tickets] r16489 - Avoid dropping SRID in ST_ClusterWithin

Daniel Baston dbaston at gmail.com
Fri Mar 23 12:47:53 PDT 2018


Author: dbaston
Date: 2018-03-23 12:47:53 -0700 (Fri, 23 Mar 2018)
New Revision: 16489

Modified:
   trunk/liblwgeom/lwgeom_geos_cluster.c
   trunk/regress/tickets.sql
   trunk/regress/tickets_expected
Log:
Avoid dropping SRID in ST_ClusterWithin

Resolves #4055



Modified: trunk/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos_cluster.c	2018-03-23 14:57:29 UTC (rev 16488)
+++ trunk/liblwgeom/lwgeom_geos_cluster.c	2018-03-23 19:47:53 UTC (rev 16489)
@@ -570,7 +570,9 @@
 			}
 			else
 			{
-				(*clusterGeoms)[k++] = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+				GEOSGeometry* combined = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+				GEOSSetSRID(combined, GEOSGetSRID(((GEOSGeometry**) geoms_in_cluster)[0]));
+				(*clusterGeoms)[k++] = combined;
 			}
 			j = 0;
 		}

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2018-03-23 14:57:29 UTC (rev 16488)
+++ trunk/regress/tickets.sql	2018-03-23 19:47:53 UTC (rev 16489)
@@ -1081,5 +1081,8 @@
 SELECT '#4037.3', ST_AsText(ST_SymDifference('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))', ST_MakeEnvelope(2,2,8,8)));
 SELECT '#4037.4', ST_AsText(ST_Union('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))', ST_MakeEnvelope(2,2,8,8)));
 
+-- #4055
+SELECT '#4055', ST_SRID(unnest(ST_ClusterWithin(ARRAY['SRID=4326;POINT (3 7)'::geometry, 'SRID=4326;LINESTRING (3 0, 3 9)'], 0)));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2018-03-23 14:57:29 UTC (rev 16488)
+++ trunk/regress/tickets_expected	2018-03-23 19:47:53 UTC (rev 16489)
@@ -346,3 +346,4 @@
 NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
 NOTICE:  Self-intersection
 #4037.4|POLYGON((0 0,2 2,2 8,0 10,10 10,8 8,8 2,10 0,0 0))
+#4055|4326



More information about the postgis-tickets mailing list