From: Daniel Baston Date: Sat, 24 Mar 2018 00:00:32 +0000 (+0000) Subject: Avoid dropping SRID in ST_ClusterIntersecting X-Git-Tag: 2.4.4~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac42d6908c20af56653fc99c39e59e06435ffe54;p=postgis Avoid dropping SRID in ST_ClusterIntersecting References #4055 git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@16491 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwgeom_geos_cluster.c b/liblwgeom/lwgeom_geos_cluster.c index 00f7693cf..42bea975b 100644 --- a/liblwgeom/lwgeom_geos_cluster.c +++ b/liblwgeom/lwgeom_geos_cluster.c @@ -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; } diff --git a/regress/tickets.sql b/regress/tickets.sql index c5745e882..30361679d 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -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; diff --git a/regress/tickets_expected b/regress/tickets_expected index 7ae44fc62..5a2221adc 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -306,3 +306,5 @@ ERROR: invalid KML representation #3704|t #3709|t #3774|t +#4055a|4326 +#4055b|4326