[postgis-tickets] r16491 - Avoid dropping SRID in ST_ClusterIntersecting
Daniel Baston
dbaston at gmail.com
Fri Mar 23 05:00:32 PDT 2018
Author: dbaston
Date: 2018-03-23 17:00:32 -0700 (Fri, 23 Mar 2018)
New Revision: 16491
Modified:
branches/2.4/liblwgeom/lwgeom_geos_cluster.c
branches/2.4/regress/tickets.sql
branches/2.4/regress/tickets_expected
Log:
Avoid dropping SRID in ST_ClusterIntersecting
References #4055
Modified: branches/2.4/liblwgeom/lwgeom_geos_cluster.c
===================================================================
--- branches/2.4/liblwgeom/lwgeom_geos_cluster.c 2018-03-23 20:40:20 UTC (rev 16490)
+++ branches/2.4/liblwgeom/lwgeom_geos_cluster.c 2018-03-24 00:00:32 UTC (rev 16491)
@@ -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.4/regress/tickets.sql
===================================================================
--- branches/2.4/regress/tickets.sql 2018-03-23 20:40:20 UTC (rev 16490)
+++ branches/2.4/regress/tickets.sql 2018-03-24 00:00:32 UTC (rev 16491)
@@ -1025,5 +1025,9 @@
-- #3774
select '#3774', abs(pi() + 2 - st_length('COMPOUNDCURVE(CIRCULARSTRING(0 0, 1 1, 2 0), (2 0, 4 0))'::geometry)) < 0.000000001;
+-- #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.4/regress/tickets_expected
===================================================================
--- branches/2.4/regress/tickets_expected 2018-03-23 20:40:20 UTC (rev 16490)
+++ branches/2.4/regress/tickets_expected 2018-03-24 00:00:32 UTC (rev 16491)
@@ -306,3 +306,5 @@
#3704|t
#3709|t
#3774|t
+#4055a|4326
+#4055b|4326
More information about the postgis-tickets
mailing list