[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.3-6-gd719113

git at osgeo.org git at osgeo.org
Tue Jul 6 06:54:16 PDT 2021


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.1 has been updated
       via  d7191135a2db03a6b87543343cca9fb149596f9e (commit)
      from  de40b71dc1037bd83a8f228d55ee2f8f9ef00ed8 (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 d7191135a2db03a6b87543343cca9fb149596f9e
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue Jul 6 12:40:34 2021 +0200

    Return the full ("fit") face mbr from cb_getFacesById
    
    Add test of face mbr invalidity on TopoGeo_addLineString
    
    References #4941 in stable-3.1 branch (3.1.4dev)

diff --git a/NEWS b/NEWS
index 4116c08..dc1d19e 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 3.1.4
 
 * Bug Fixes
   - #4918, Fix rare crash in st_minpossiblevalue (Paul Ramsey)
+  - #4941, Fix loose mbr in topology.face on update (Sandro Santilli)
 
 
 PostGIS 3.1.3
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index be74d9a..f7ba493 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -873,9 +873,11 @@ fillFaceFields(LWT_ISO_FACE* face, HeapTuple row, TupleDesc rowdesc, int fields)
       /* NOTE: this is a geometry of which we want to take (and clone) the BBOX */
       geom = (GSERIALIZED *)PG_DETOAST_DATUM(dat);
       g = lwgeom_from_gserialized(geom);
+      lwgeom_refresh_bbox(g); /* Ensure we use a fit mbr, see #4149 */
       box = lwgeom_get_bbox(g);
       if ( box )
       {
+        POSTGIS_DEBUGF(1, "Face %d bbox xmin is %.15g", face->face_id, box->xmin);
         face->mbr = gbox_clone(box);
       }
       else
diff --git a/topology/test/regress/topogeo_addlinestring.sql b/topology/test/regress/topogeo_addlinestring.sql
index a510b52..c9f3463 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -399,3 +399,60 @@ FROM topology.TopoGeo_addLinestring('t4758',
   'LINESTRING( 11.38330505 60.408239599999995, 11.3832721  60.408194249999994)') AS t
 ORDER BY t;
 SELECT 't4758.end', topology.DropTopology('t4758');
+
+-- See https://trac.osgeo.org/postgis/ticket/4941
+SELECT NULL FROM createtopology('b4941');
+SELECT 'b4941', 'outer_ring', count(*) FROM (
+  SELECT TopoGeo_addLineString('b4941',
+  'LINESTRING(
+    12.123711265448206 65.12785021295713,
+    12.123711265448206 65.21007378815003,
+    12.208829785296102 65.12785021295713,
+    12.123711265448206 65.12785021295713)
+  ')
+) foo;
+SELECT 'b4941', 'mbr-invalid-before', face_id
+FROM b4941.face
+WHERE face_id > 0
+AND NOT ST_Equals(
+    mbr,
+    ST_Envelope(
+      ST_GetFaceGeometry('b4941', face_id)
+    )
+  );
+SELECT 'b4941', 'inner_ring', count(*) FROM (
+  SELECT TopoGeo_addLineString('b4941',
+    'LINESTRING(
+      12.164016376530826 65.16373151830707,
+      12.164026259700226 65.16368501062713,
+      12.164003720888175 65.16368611107725,
+      12.164016376530826 65.16373151830707
+    )')
+) foo;
+SELECT 'b4941', 'mbr-invalid-after-hole', face_id
+FROM b4941.face
+WHERE face_id > 0
+AND NOT ST_Equals(
+    mbr,
+    ST_Envelope(
+      ST_GetFaceGeometry('b4941', face_id)
+    )
+  );
+SELECT 'b4941', 'crossing_line', count(*) FROM (
+  SELECT TopoGeo_addLineString('b4941',
+    'LINESTRING(
+      12.123387 65.128411,
+      12.164015866 65.163701383,
+      12.168618 65.167537
+    )')
+) foo;
+SELECT 'b4941', 'mbr-invalid-after-cross', face_id
+FROM b4941.face
+WHERE face_id > 0
+AND NOT ST_Equals(
+    mbr,
+    ST_Envelope(
+      ST_GetFaceGeometry('b4941', face_id)
+    )
+  );
+SELECT NULL FROM topology.DropTopology('b4941');
diff --git a/topology/test/regress/topogeo_addlinestring_expected b/topology/test/regress/topogeo_addlinestring_expected
index d786940..7bd753d 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -217,3 +217,6 @@ t4758.2|2
 t4758.2|4
 t4758.2|5
 t4758.end|Topology 't4758' dropped
+b4941|outer_ring|1
+b4941|inner_ring|1
+b4941|crossing_line|5

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

Summary of changes:
 NEWS                                               |  1 +
 topology/postgis_topology.c                        |  2 +
 topology/test/regress/topogeo_addlinestring.sql    | 57 ++++++++++++++++++++++
 .../test/regress/topogeo_addlinestring_expected    |  3 ++
 4 files changed, 63 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list