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

Daniel Baston dbaston at gmail.com
Fri Mar 23 01:40:20 PDT 2018


Author: dbaston
Date: 2018-03-23 13:40:20 -0700 (Fri, 23 Mar 2018)
New Revision: 16490

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

There was not actually a problem with ST_ClusterWithin, and the previous
commit did not resolve the problem with ST_ClusterIntersecting.

References #4055



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

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2018-03-23 19:47:53 UTC (rev 16489)
+++ trunk/regress/tickets.sql	2018-03-23 20:40:20 UTC (rev 16490)
@@ -1082,7 +1082,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)));
+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: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2018-03-23 19:47:53 UTC (rev 16489)
+++ trunk/regress/tickets_expected	2018-03-23 20:40:20 UTC (rev 16490)
@@ -346,4 +346,5 @@
 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
+#4055a|4326
+#4055b|4326



More information about the postgis-tickets mailing list