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

Daniel Baston dbaston at gmail.com
Fri Mar 23 05:03:15 PDT 2018


Author: dbaston
Date: 2018-03-23 17:03:15 -0700 (Fri, 23 Mar 2018)
New Revision: 16493

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

References #4055



Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2018-03-24 00:01:14 UTC (rev 16492)
+++ branches/2.2/NEWS	2018-03-24 00:03:15 UTC (rev 16493)
@@ -5,6 +5,7 @@
   - #3965, ST_ClusterKMeans used to lose some clusters on initialization
            (Darafei Praliaskouski)
   - #3978, Fix KNN when upgrading from 2.1 or older (Sandro Santilli)
+  - #4055, ST_ClusterIntersecting dropping SRID (Daniel Baston)
   - #4017, lwgeom lexer memory corruption (Peter E)
 
 

Modified: branches/2.2/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- branches/2.2/liblwgeom/lwgeom_geos_cluster.c	2018-03-24 00:01:14 UTC (rev 16492)
+++ branches/2.2/liblwgeom/lwgeom_geos_cluster.c	2018-03-24 00:03:15 UTC (rev 16493)
@@ -365,7 +365,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.2/regress/tickets.sql
===================================================================
--- branches/2.2/regress/tickets.sql	2018-03-24 00:01:14 UTC (rev 16492)
+++ branches/2.2/regress/tickets.sql	2018-03-24 00:03:15 UTC (rev 16493)
@@ -995,5 +995,9 @@
 SELECT '#3627a', ST_AsEncodedPolyline('SRID=4326;LINESTRING(-0.250691 49.283048,-0.250633 49.283376,-0.250502 49.283972,-0.251245 49.284028,-0.251938 49.284232,-0.251938 49.2842)', 6);
 SELECT '#3627b', ST_Equals(geom, ST_LineFromEncodedPolyline(ST_AsEncodedPolyline(geom, 7), 7)) FROM (VALUES ('SRID=4326;LINESTRING (0 0, 1 1)')) AS v (geom);
 
+-- #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.2/regress/tickets_expected
===================================================================
--- branches/2.2/regress/tickets_expected	2018-03-24 00:01:14 UTC (rev 16492)
+++ branches/2.2/regress/tickets_expected	2018-03-24 00:03:15 UTC (rev 16493)
@@ -298,3 +298,5 @@
 #3583|MULTIPOLYGON Z (EMPTY)
 #3627a|o}~~|AdshNoSsBgd at eGoBlm@wKhj@~@?
 #3627b|t
+#4055a|4326
+#4055b|4326



More information about the postgis-tickets mailing list