[SCM] PostGIS branch master updated. 3.6.0rc2-290-g6388f5be6
git at osgeo.org
git at osgeo.org
Tue Jan 20 12:34:05 PST 2026
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 6388f5be621ac58fb49b39ab098ed49d7d826fec (commit)
from 0a5d1263b5b75114b15e8915e4ecce2827c08476 (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 6388f5be621ac58fb49b39ab098ed49d7d826fec
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date: Fri Dec 19 07:30:24 2025 +0100
Convert PolyhedralSurface/TIN to MultiPolygon
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index a2d65dc0f..c6562b5fa 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -414,6 +414,43 @@ lwgeom_as_multi(const LWGEOM *lwgeom)
type = lwgeom->type;
+ /*
+ * PolyhedralSurface and MultiPolygon have identical structures
+ * (both are collections of LWPOLY). Convert PolyhedralSurface
+ * to MultiPolygon by cloning and changing the type.
+ */
+ if (type == POLYHEDRALSURFACETYPE)
+ {
+ ogeom = (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
+ ogeom->type = MULTIPOLYGONTYPE;
+ return ogeom;
+ }
+
+ /*
+ * TIN to MultiPolygon: convert each triangle to a polygon.
+ * LWTRIANGLE and LWLINE have compatible memory layouts,
+ * so we can use lwpoly_from_lwlines to create polygons.
+ */
+ if (type == TINTYPE)
+ {
+ uint32_t i;
+ LWCOLLECTION *col = (LWCOLLECTION *)lwgeom;
+ LWMPOLY *mpoly = lwmpoly_construct_empty(lwgeom->srid,
+ FLAGS_GET_Z(lwgeom->flags),
+ FLAGS_GET_M(lwgeom->flags));
+
+ for (i = 0; i < col->ngeoms; i++)
+ {
+ LWPOLY *poly = lwpoly_from_lwlines((LWLINE *)col->geoms[i], 0, NULL);
+ lwmpoly_add_lwpoly(mpoly, poly);
+ }
+
+ if (lwgeom->bbox)
+ mpoly->bbox = gbox_clone(lwgeom->bbox);
+
+ return lwmpoly_as_lwgeom(mpoly);
+ }
+
if ( ! MULTITYPE[type] ) return lwgeom_clone(lwgeom);
if( lwgeom_is_empty(lwgeom) )
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index ed5f076f2..0cfa08da7 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -532,7 +532,6 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
case COLLECTIONTYPE:
case MULTICURVETYPE:
case MULTISURFACETYPE:
- case TINTYPE:
PG_RETURN_POINTER(geom);
default:
break;
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index eec195810..4c1fcb862 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -67,6 +67,14 @@ SELECT '#80', ST_AsText(ST_Multi('MULTILINESTRING((0 0,1 1))'));
-- #83 --
SELECT '#83', ST_AsText(ST_Multi(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)')));
+-- ST_Multi with PolyhedralSurface -> MultiPolygon
+SELECT 'ST_Multi_psurface', ST_GeometryType(ST_Multi('POLYHEDRALSURFACE Z(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,0 1 0,0 1 1,0 0 1,0 0 0)))'::geometry));
+SELECT 'ST_Multi_psurface_empty', ST_GeometryType(ST_Multi('POLYHEDRALSURFACE EMPTY'::geometry));
+
+-- ST_Multi with TIN -> MultiPolygon
+SELECT 'ST_Multi_tin', ST_GeometryType(ST_Multi('TIN Z(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 1 0,0 0 0)))'::geometry));
+SELECT 'ST_Multi_tin_empty', ST_GeometryType(ST_Multi('TIN EMPTY'::geometry));
+
-- #85 --
SELECT '#85', ST_Distance(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)'), ST_Point(220268, 150415));
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index d8f7f5cf5..76ea65e71 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -14,6 +14,10 @@ ERROR: lwgeom_longitude_shift: unsupported geom type: CircularString
#73|GEOMETRYCOLLECTION(CIRCULARSTRING(1 1,2 3,4 5,6 7,5 6))
#80|MULTILINESTRING((0 0,1 1))
#83|MULTICURVE(CIRCULARSTRING(220268 150415,220227 150505,220227 150406))
+ST_Multi_psurface|ST_MultiPolygon
+ST_Multi_psurface_empty|ST_MultiPolygon
+ST_Multi_tin|ST_MultiPolygon
+ST_Multi_tin_empty|ST_MultiPolygon
#85|0
#112|GEOMETRYCOLLECTION(POINT(-10 50))
ERROR: Input geometry does not have a measure dimension
-----------------------------------------------------------------------
Summary of changes:
liblwgeom/lwgeom.c | 37 +++++++++++++++++++++++++++++++++++++
postgis/lwgeom_functions_basic.c | 1 -
regress/core/tickets.sql | 8 ++++++++
regress/core/tickets_expected | 4 ++++
4 files changed, 49 insertions(+), 1 deletion(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list