]> granicus.if.org Git - postgis/commitdiff
Avoid dropping SRID in ST_ClusterWithin
authorDaniel Baston <dbaston@gmail.com>
Fri, 23 Mar 2018 19:47:53 +0000 (19:47 +0000)
committerDaniel Baston <dbaston@gmail.com>
Fri, 23 Mar 2018 19:47:53 +0000 (19:47 +0000)
Resolves #4055

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

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

index 00f7693cf3f9a924f61986302b05749cc769f1a3..e10e8eb10ba76f36075ec9f59d29a9159196e4c6 100644 (file)
@@ -570,7 +570,9 @@ combine_geometries(UNIONFIND* uf, void** geoms, uint32_t num_geoms, void*** clus
                        }
                        else
                        {
-                               (*clusterGeoms)[k++] = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+                               GEOSGeometry* combined = GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, (GEOSGeometry**) geoms_in_cluster, j);
+                               GEOSSetSRID(combined, GEOSGetSRID(((GEOSGeometry**) geoms_in_cluster)[0]));
+                               (*clusterGeoms)[k++] = combined;
                        }
                        j = 0;
                }
index 974620f14deb11a41bf76c3692a2b014fdb2158c..adcdb5697983622290bc32472139800b24307145 100644 (file)
@@ -1081,5 +1081,8 @@ SELECT '#4037.2', ST_AsText(ST_Difference('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0)
 SELECT '#4037.3', ST_AsText(ST_SymDifference('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))', ST_MakeEnvelope(2,2,8,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)));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index 2e408435270b8dfa311a9820c24237225af3727c..9e795ec87f02bd913f3d1d8cb2ee84e00d1ae334 100644 (file)
@@ -346,3 +346,4 @@ NOTICE:  Self-intersection
 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