[SCM] PostGIS branch stable-3.3 updated. 3.3.6-20-g876936195

git at osgeo.org git at osgeo.org
Mon Apr 8 11:09:06 PDT 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, stable-3.3 has been updated
       via  8769361951c659719f8292303d55f1dbfa3f85e5 (commit)
      from  72946a200bf7f6e46df1ec95947d97ff3ef90673 (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 8769361951c659719f8292303d55f1dbfa3f85e5
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Apr 8 19:59:15 2024 +0200

    Make sure ST_ChangeEdgeGeom gets a fit view on edge's bounding boxes
    
    Reference #5709 in 3.3 branch (3.3.7dev)
    
    Includes regression testcase

diff --git a/NEWS b/NEWS
index 77ffb6495..9f7808021 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ xxxx/xx/xx
 
 * Bug Fixes and Enhancements *
 
+ - #5709, Fix loose mbr in topology.face on ST_ChangeEdgeGeom (Sandro Santilli)
  - #5698, Fix robustness issue splitting line by vertex very close to endpoints,
           affecting topology population functions (Sandro Santilli)
  - #5649, ST_Value should return NULL on missing band (Paul Ramsey)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 8ed0deff2..e21ddf007 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -3487,8 +3487,12 @@ lwt_ChangeEdgeGeom(LWT_TOPOLOGY* topo, LWT_ELEMID edge_id, LWLINE *geom)
   --       would be larger than the old face MBR...
   --
   */
-  const GBOX* oldbox = lwgeom_get_bbox(lwline_as_lwgeom(oldedge->geom));
-  const GBOX* newbox = lwgeom_get_bbox(lwline_as_lwgeom(geom));
+  LWGEOM *oldgeom = lwline_as_lwgeom(oldedge->geom);
+  LWGEOM *newgeom = lwline_as_lwgeom(geom);
+  lwgeom_refresh_bbox(oldgeom); /* Ensure we use a fit mbr, see #5709 -- TODO: fix this at lower level */
+  lwgeom_refresh_bbox(newgeom); /* Ensure we use a fit mbr, see #5709 -- TODO: fix this at lower level */
+  const GBOX* oldbox = lwgeom_get_bbox(oldgeom);
+  const GBOX* newbox = lwgeom_get_bbox(newgeom);
   if ( ! gbox_same(oldbox, newbox) )
   {
     GBOX* updatedBox;
diff --git a/topology/test/regress/st_changeedgegeom.sql b/topology/test/regress/st_changeedgegeom.sql
index 7822035e0..7f2605e4e 100644
--- a/topology/test/regress/st_changeedgegeom.sql
+++ b/topology/test/regress/st_changeedgegeom.sql
@@ -150,3 +150,39 @@ ROLLBACK;
 
 SELECT topology.DropTopology('city_data');
 
+-- See https://trac.osgeo.org/postgis/ticket/5709
+SELECT NULL FROM createtopology('t5709');
+SELECT 't5709', 'edge', * FROM TopoGeo_addLineString('t5709',
+  'LINESTRING(
+    0 0,
+    5 65.2,
+    10 0,
+    0 0)
+  ');
+SELECT 't5709', 'mbr-invalid-before', face_id
+FROM t5709.face
+WHERE face_id > 0
+AND NOT ST_Equals(
+    mbr,
+    ST_Envelope(
+      ST_GetFaceGeometry('t5709', face_id)
+    )
+  );
+--set client_min_messages to DEBUG;
+SELECT NULL FROM ST_ChangeEdgeGeom('t5709', 1,
+  'LINESTRING(
+    0 0,
+    5 65.2000000000001,
+    10 0,
+    0 0)
+  ');
+SELECT 't5709', 'mbr-invalid-after', face_id
+FROM t5709.face
+WHERE face_id > 0
+AND NOT ST_Equals(
+    mbr,
+    ST_Envelope(
+      ST_GetFaceGeometry('t5709', face_id)
+    )
+  );
+SELECT NULL FROM topology.DropTopology('t5709');
diff --git a/topology/test/regress/st_changeedgegeom_expected b/topology/test/regress/st_changeedgegeom_expected
index 9e29700c7..f2bc4fb95 100644
--- a/topology/test/regress/st_changeedgegeom_expected
+++ b/topology/test/regress/st_changeedgegeom_expected
@@ -36,3 +36,4 @@ T13.2|Edge 29 changed
 T13.3|26
 ERROR:  Edge motion collision at POINT(-1.1697 47.7825)
 Topology 'city_data' dropped
+t5709|edge|1

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

Summary of changes:
 NEWS                                             |  1 +
 liblwgeom/lwgeom_topo.c                          |  8 ++++--
 topology/test/regress/st_changeedgegeom.sql      | 36 ++++++++++++++++++++++++
 topology/test/regress/st_changeedgegeom_expected |  1 +
 4 files changed, 44 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list