[SCM] PostGIS branch master updated. 3.4.0rc1-944-g15c8d95ef

git at osgeo.org git at osgeo.org
Mon Feb 26 11:30:47 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  15c8d95efcff17d1d1b993a3e5480cb7c490760b (commit)
      from  b3429f87992d9e3c884d1ab7243495bff8b2771a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 15c8d95efcff17d1d1b993a3e5480cb7c490760b
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Feb 26 11:23:46 2024 -0800

    Union the contents of a single-member array before returning, so that collections get flattened. References #5677

diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 4ee151cba..92b2b5f53 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -600,6 +600,9 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
 	if ( count == 0 )
 		PG_RETURN_NULL();
 
+	/* Ok, we really need GEOS now ;) */
+	initGEOS(lwpgnotice, lwgeom_geos_error);
+
 	/* One geom, good geom? Return it */
 	if ( count == 1 && nelems == 1 )
 	{
@@ -607,15 +610,19 @@ Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wsign-compare"
 #endif
-		PG_RETURN_POINTER((GSERIALIZED *)(ARR_DATA_PTR(array)));
+		g = POSTGIS2GEOS((GSERIALIZED *)(ARR_DATA_PTR(array)));
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 #pragma GCC diagnostic pop
 #endif
+		g_union = GEOSUnaryUnion(g);
+		GEOSGeom_destroy(g);
+		if (!g_union) HANDLE_GEOS_ERROR("GEOSUnaryUnion");
+		GEOSSetSRID(g_union, srid);
+		gser_out = GEOS2POSTGIS(g_union, is3d);
+		GEOSGeom_destroy(g_union);
+		PG_RETURN_POINTER(gser_out);
 	}
 
-	/* Ok, we really need GEOS now ;) */
-	initGEOS(lwpgnotice, lwgeom_geos_error);
-
 	/*
 	** Collect the non-empty inputs and stuff them into a GEOS collection
 	*/

-----------------------------------------------------------------------

Summary of changes:
 postgis/lwgeom_geos.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list