[postgis-tickets] r16492 - Avoid dropping SRID in ST_ClusterIntersecting

Daniel Baston dbaston at gmail.com
Fri Mar 23 05:01:14 PDT 2018


Author: dbaston
Date: 2018-03-23 17:01:14 -0700 (Fri, 23 Mar 2018)
New Revision: 16492

Modified:
   branches/2.3/liblwgeom/lwgeom_geos_cluster.c
   branches/2.3/regress/tickets.sql
   branches/2.3/regress/tickets_expected
Log:
Avoid dropping SRID in ST_ClusterIntersecting

References #4055



Modified: branches/2.3/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- branches/2.3/liblwgeom/lwgeom_geos_cluster.c	2018-03-24 00:00:32 UTC (rev 16491)
+++ branches/2.3/liblwgeom/lwgeom_geos_cluster.c	2018-03-24 00:01:14 UTC (rev 16492)
@@ -570,7 +570,10 @@
 			}
 			else
 			{
-				(*clusterGeoms)[k++] = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+				int srid = GEOSGetSRID(((GEOSGeometry**) geoms_in_cluster)[0]);
+				GEOSGeometry* combined = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+				GEOSSetSRID(combined, srid);
+				(*clusterGeoms)[k++] = combined;
 			}
 			j = 0;
 		}

Modified: branches/2.3/regress/tickets.sql
===================================================================
--- branches/2.3/regress/tickets.sql	2018-03-24 00:00:32 UTC (rev 16491)
+++ branches/2.3/regress/tickets.sql	2018-03-24 00:01:14 UTC (rev 16492)
@@ -1015,5 +1015,9 @@
 -- #3704
 SELECT '#3704', ST_AsX3D('LINESTRING EMPTY') = '';
 
+-- #4055
+SELECT '#4055a', ST_SRID(unnest(ST_ClusterWithin(ARRAY['SRID=4326;POINT (3 7)'::geometry, 'SRID=4326;LINESTRING (3 0, 3 9)'], 0)));
+SELECT '#4055b', ST_SRID(unnest(ST_ClusterIntersecting(ARRAY['SRID=4326;POINT (3 7)'::geometry, 'SRID=4326;LINESTRING (3 0, 3 9)'])));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;

Modified: branches/2.3/regress/tickets_expected
===================================================================
--- branches/2.3/regress/tickets_expected	2018-03-24 00:00:32 UTC (rev 16491)
+++ branches/2.3/regress/tickets_expected	2018-03-24 00:01:14 UTC (rev 16492)
@@ -302,3 +302,5 @@
 #3627a|o}~~|AdshNoSsBgd at eGoBlm@wKhj@~@?
 #3627b|t
 #3704|t
+#4055a|4326
+#4055b|4326



More information about the postgis-tickets mailing list