[postgis-tickets] [SCM] PostGIS branch stable-3.0 updated. 3.0.3-22-g27ae21c

git at osgeo.org git at osgeo.org
Tue Jul 6 06:54:29 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.0 has been updated
       via  27ae21c50959e85d5b2695174cb4fd4f767b0f76 (commit)
      from  3abe89a6a54d68f9dcde978b5d39889b27a431f2 (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 27ae21c50959e85d5b2695174cb4fd4f767b0f76
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
    
    Closes #4941 in stable-3.0 branch (3.0.4dev)

diff --git a/NEWS b/NEWS
index ad72293..96a0b17 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PostGIS 3.0.4dev
 2021/xx/xx
 
+  - #4941, Fix loose mbr in topology.face on update (Sandro Santilli)
   - #4871, TopoGeometry::geometry cast returns NULL for empty
            TopoGeometry objects (Sandro Santilli)
   - #4817, Handle complex compound coordinate systems (Paul Ramsey)
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 6430050..07f1c02 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -883,9 +883,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 161816d..37c7e56 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -403,3 +403,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 84e59fd..6166f55 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