]> granicus.if.org Git - postgis/commitdiff
Avoid dropping SRID in ST_ClusterIntersecting
authorDaniel Baston <dbaston@gmail.com>
Sat, 24 Mar 2018 00:00:32 +0000 (00:00 +0000)
committerDaniel Baston <dbaston@gmail.com>
Sat, 24 Mar 2018 00:00:32 +0000 (00:00 +0000)
References #4055

git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@16491 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgeom_geos_cluster.c
regress/tickets.sql
regress/tickets_expected

index 00f7693cf3f9a924f61986302b05749cc769f1a3..42bea975bb0f103add4e8367dcc16a28d312de21 100644 (file)
@@ -570,7 +570,10 @@ combine_geometries(UNIONFIND* uf, void** geoms, uint32_t num_geoms, void*** clus
                        }
                        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;
                }
index c5745e8822accd90e586570b5220672a6c0fe793..30361679d8a7198d1ea8e8fb1ad0fa422747efb7 100644 (file)
@@ -1025,5 +1025,9 @@ select '#3709', ST_SnapToGrid(ST_Project('SRID=4326;POINT(1 1)'::geography, 1000
 -- #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;
index 7ae44fc6285b279007188019c793a9297d625ad1..5a2221adc778967101678a7f30e84c981e77ec91 100644 (file)
@@ -306,3 +306,5 @@ ERROR:  invalid KML representation
 #3704|t
 #3709|t
 #3774|t
+#4055a|4326
+#4055b|4326