[SCM] PostGIS branch master updated. 3.6.0rc2-475-g05682d312
git at osgeo.org
git at osgeo.org
Thu May 7 03:06:11 PDT 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 05682d312a8b67ba7b90dfd5f89993ff082c054b (commit)
from 0e794aa474544d0da986d4ba7a807103b97c129a (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 05682d312a8b67ba7b90dfd5f89993ff082c054b
Author: Jean Felder <jean.felder at oslandia.com>
Date: Sun May 3 19:02:44 2026 +0200
sfcgal: Adapt CG_ExtrudeStraightSkeleton test to triangulation improvements
The geometry returned by CG_ExtrudeStraightSkeleton, when extrude and
roof parameters are set was triangulated. Since SFCGAL 2.3, the
triangles can be merged when the underlying surface is coplanar. This
gives a smoother result and a polyhedralsurface which has less
patches.
Adapt the unit test to work with all SFCGAL versions by comparing the
number of generated patches.
See: https://gitlab.com/sfcgal/SFCGAL/-/merge_requests/730
diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index e3abfbac0..b27b72804 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -2103,7 +2103,7 @@ It always gives a 2D result even when used on a 3D geometry.</para></note>
<title>Examples</title>
<para>
<programlisting>SELECT ST_AsText(CG_ExtrudeStraightSkeleton('POLYGON (( 0 0, 5 0, 5 5, 4 5, 4 4, 0 4, 0 0 ), (1 1, 1 2,2 2, 2 1, 1 1))', 3.0, 2.0));</programlisting>
- <screen>POLYHEDRALSURFACE Z (((0 0 0,0 4 0,4 4 0,4 5 0,5 5 0,5 0 0,0 0 0),(1 1 0,2 1 0,2 2 0,1 2 0,1 1 0)),((0 0 0,0 0 2,0 4 2,0 4 0,0 0 0)),((0 4 0,0 4 2,4 4 2,4 4 0,0 4 0)),((4 4 0,4 4 2,4 5 2,4 5 0,4 4 0)),((4 5 0,4 5 2,5 5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 2.5 2.5,0.5 0.5 2.5,1 1 2)),((1 2 2,2 2 2,3 3 3,1 3 3,0.5 2.5 2.5,1 2 2)),((2 2 2,2 1 2,2.5 0.5 2.5,3.5 1.5 3.5,3.5 2.5 3.5,3 3 3,2 2 2)))</screen>
</para>
</refsection>
<refsection>
diff --git a/sfcgal/regress/extrudestraigthskeleton.sql b/sfcgal/regress/extrudestraigthskeleton.sql
index 11d12dbf4..fc273cd58 100644
--- a/sfcgal/regress/extrudestraigthskeleton.sql
+++ b/sfcgal/regress/extrudestraigthskeleton.sql
@@ -1,43 +1,72 @@
-SELECT 'Extrude roof', ST_AsText(CG_ExtrudeStraightSkeleton('POLYGON (( 0 0, 5 0, 5 5, 4 5, 4 4, 0 4, 0 0 ), (1 1, 1 2,2 2, 2 1, 1 1))', 2.0));
-WITH
- version_info AS (
- -- The result depends on the SFCGAL Version.
- -- Prior to version 2.2, it contained extra patches.
- SELECT
- string_to_array(postgis_sfcgal_version (), '.')::INT[] AS sfcgal_version_array
- ),
- skeleton AS (
- SELECT
- ST_NumPatches (
- CG_ExtrudeStraightSkeleton (
- 'POLYGON (( 0 0, 5 0, 5 5, 4 5, 4 4, 0 4, 0 0 ), (1 1, 1 2,2 2, 2 1, 1 1))',
- 3.0,
- 2.0
- )
- ) AS num_patches
- ),
- check_patches AS (
- SELECT
- sfcgal_version_array,
- num_patches,
- (
- (
- sfcgal_version_array <= ARRAY[2, 1, 0]
- AND num_patches = 49
- )
- OR (
- sfcgal_version_array > ARRAY[2, 1, 0]
- AND num_patches = 39
- )
- ) AS test_result
- FROM
- skeleton,
- version_info
- )
-SELECT
- 'Extrude building and roof',
- test_result
-FROM
- check_patches;
+WITH version_info AS (
+ SELECT string_to_array(postgis_sfcgal_version(), '.')::int[] AS sfcgal_version_array
+),
+
+roof AS (
+ SELECT
+ ST_NumPatches(
+ CG_ExtrudeStraightSkeleton(
+ 'POLYGON ((0 0, 5 0, 5 5, 4 5, 4 4, 0 4, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))',
+ 2.0
+ )
+ ) AS num_patches,
+ sfcgal_version_array
+ FROM version_info
+),
+
+building_and_roof AS (
+ SELECT
+ ST_NumPatches(
+ CG_ExtrudeStraightSkeleton(
+ 'POLYGON ((0 0, 5 0, 5 5, 4 5, 4 4, 0 4, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))',
+ 3.0,
+ 2.0
+ )
+ ) AS num_patches,
+ sfcgal_version_array
+ FROM version_info
+)
+
+SELECT 'Extrude roof',
+ -- The result depends on the SFCGAL version.
+ -- Since version 2.3, the result is simplified by merging
+ -- triangles before storing the result, resulting in fewer
+ -- patches.
+ (
+ (
+ sfcgal_version_array < ARRAY[2,3,0]
+ AND num_patches = 38
+ )
+ OR (
+ sfcgal_version_array >= ARRAY[2,3,0]
+ AND num_patches = 11
+ )
+ )
+FROM roof
+
+UNION ALL
+
+SELECT 'Extrude building and roof',
+ -- The result depends on the SFCGAL version.
+ -- Prior to version 2.2, it contained extra patches.
+ -- Since version 2.3, the result is simplified by merging
+ -- triangles before storing the result, resulting in fewer
+ -- patches.
+ (
+ (
+ sfcgal_version_array < ARRAY[2,2,0]
+ AND num_patches = 49
+ )
+ OR (
+ sfcgal_version_array >= ARRAY[2,2,0]
+ AND sfcgal_version_array < ARRAY[2,3,0]
+ AND num_patches = 39
+ )
+ OR (
+ sfcgal_version_array >= ARRAY[2,3,0]
+ AND num_patches = 21
+ )
+ )
+FROM building_and_roof;
SELECT 'Empty building and roof', ST_AsText(CG_ExtrudeStraightSkeleton(ST_GeomFromText('POLYGON EMPTY',4326), 20.1, 20.1));
SELECT 'Empty roof', ST_AsText(CG_ExtrudeStraightSkeleton(ST_GeomFromText('POLYGON EMPTY',4326), 20.1));
diff --git a/sfcgal/regress/extrudestraigthskeleton_expected b/sfcgal/regress/extrudestraigthskeleton_expected
index 8a8ac4ddc..b64e6d458 100644
--- a/sfcgal/regress/extrudestraigthskeleton_expected
+++ b/sfcgal/regress/extrudestraigthskeleton_expected
@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 0.5 0.5)),((1 1 0,1 2 0,0.5 2.5 0.5,1 1 0)),((0.5 0.5 0.5,1 1 0,0.5 2.5 0.5,0.5 0.5 0.5)),((1 3 1,2 2 0,3 3 1,1 3 1)),((0.5 2.5 0.5,1 2 0,1 3 1,0.5 2.5 0.5)),((1 3 1,1 2 0,2 2 0,1 3 1)),((2 2 0,2 1 0,2.5 0.5 0.5,2 2 0)),((3.5 2.5 1.5,3 3 1,3.5 1.5 1.5,3.5 2.5 1.5)),((3.5 1.5 1.5,2 2 0,2.5 0.5 0.5,3.5 1.5 1.5)),((3 3 1,2 2 0,3.5 1.5 1.5,3 3 1)))
+Extrude roof|t
Extrude building and roof|t
Empty building and roof|POLYHEDRALSURFACE EMPTY
Empty roof|POLYHEDRALSURFACE EMPTY
-----------------------------------------------------------------------
Summary of changes:
doc/reference_sfcgal.xml | 2 +-
sfcgal/regress/extrudestraigthskeleton.sql | 111 +++++++++++++++---------
sfcgal/regress/extrudestraigthskeleton_expected | 2 +-
3 files changed, 72 insertions(+), 43 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list