[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-266-gc909a66

git at osgeo.org git at osgeo.org
Mon Jul 5 13:13:09 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, main has been updated
       via  c909a660377709699f7a1529d990a00c2f276593 (commit)
       via  02d6ca3eb18d65c217dc484faf3d8d4e8a7928fe (commit)
      from  d60698ed1c566f98c5c41bcd1f9ba7d746734f95 (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 c909a660377709699f7a1529d990a00c2f276593
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Jul 5 22:11:08 2021 +0200

    Add face.mbr consistency check in ValidateTopology
    
    Closes #3276

diff --git a/NEWS b/NEWS
index e87d347..5cc7e53 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PostGIS 3.2.0
   - #4933, topology.GetFaceByPoint will not work with topologies having invalid edge linking.
 
  * Enhancements *
+  - #3276, ValidateTopology check for face's mbr (Sandro Santilli)
   - #4936, Bounding box limited ValidateTopology (Sandro Santilli)
   - #4933, Speed up topology building in presence of big faces (Sandro Santilli)
   - #3233, ValidateTopology check for node's containing_face (Sandro Santilli)
diff --git a/topology/test/invalid_topology.sql b/topology/test/invalid_topology.sql
index 1bcd260..0512ca4 100644
--- a/topology/test/invalid_topology.sql
+++ b/topology/test/invalid_topology.sql
@@ -150,7 +150,7 @@ INSERT INTO invalid_topology.edge VALUES(32, 4, 4, 31, -31, 12, 12,
 INSERT INTO invalid_topology.edge VALUES(33, 3, 3, 28, 28, 13, 13,
   '01020000000100000000000000000039400000000000804140');
 
--- Set face mbr based on referencing edges mbr
+-- Set face mbr based on referencing non-dangling edges
 UPDATE invalid_topology.face f
 SET mbr = (
   WITH env AS (
@@ -158,6 +158,7 @@ SET mbr = (
     FROM invalid_topology.edge e
     WHERE
       ( e.left_face = f.face_id OR e.right_face = f.face_id )
+      AND NOT e.left_face = e.right_face -- skip dangling
   )
   SELECT ST_MakeEnvelope(st_xmin(env), st_ymin(env), st_xmax(env), st_ymax(env))
   FROM env
diff --git a/topology/test/regress/legacy_invalid_expected b/topology/test/regress/legacy_invalid_expected
index ffcf2b0..9a1b831 100644
--- a/topology/test/regress/legacy_invalid_expected
+++ b/topology/test/regress/legacy_invalid_expected
@@ -15,6 +15,8 @@ edge crosses edge|30|32
 edge start node geometry mis-match|30|4
 edge end node geometry mis-match|30|3
 face without edges|10|
+face has wrong mbr|3|
+face has wrong mbr|6|
 face has no rings|10|
 face within face|11|2
 face overlaps face|2|12
@@ -22,7 +24,9 @@ not-isolated node has not-null containing_face|4|
 edge not covered by both its side faces|27|
 edge not covered by both its side faces|28|
 edge not covered by both its side faces|30|
-#4936|missing_count|2
+#4936|missing_count|4
 #4936|missing|face has no rings|10|
+#4936|missing|face overlaps face|2|12
+#4936|missing|face within face|11|2
 #4936|missing|face without edges|10|
 Topology 'invalid_topology' dropped
diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index bae374c..9156136 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -1762,20 +1762,35 @@ BEGIN
   CREATE INDEX "face_check_bt" ON face_check (face_id);
 
   -- Scan the table looking for NULL geometries
-  RAISE DEBUG 'Checking for faces with no rings';
+  -- or geometries with wrong MBR consistency
+  RAISE DEBUG 'Checking faces';
   FOR rec IN
-    SELECT face_id FROM face_check
-    WHERE geom IS NULL OR ST_IsEmpty(geom)
+    SELECT * FROM face_check
   LOOP --{
-    -- Face missing !
-    retrec.error := 'face has no rings';
-    retrec.id1 := rec.face_id;
-    retrec.id2 := NULL;
-    RETURN NEXT retrec;
+
+    IF rec.geom IS NULL OR ST_IsEmpty(rec.geom)
+    THEN
+      -- Face missing !
+      retrec.error := 'face has no rings';
+      retrec.id1 := rec.face_id;
+      retrec.id2 := NULL;
+      RETURN NEXT retrec;
+    END IF;
+
+    IF NOT ST_Equals(rec.mbr, ST_Envelope(rec.geom))
+    THEN
+      RAISE DEBUG 'MBR expected:% obtained:%', ST_AsEWKT(rec.mbr), ST_AsEWKT(ST_Envelope(rec.geom));
+      -- Inconsistent MBR!
+      retrec.error := 'face has wrong mbr';
+      retrec.id1 := rec.face_id;
+      retrec.id2 := NULL;
+      RETURN NEXT retrec;
+    END IF;
+
   END LOOP; --}
 
   -- Scan the table looking for overlap or containment
-  -- TODO: also check for MBR consistency
+  -- TODO: do this check as part of the earlier loop
   RAISE DEBUG 'Checking for face-in-face';
   FOR rec IN
     SELECT

commit 02d6ca3eb18d65c217dc484faf3d8d4e8a7928fe
Author: Sandro Santilli <strk at kbt.io>
Date:   Fri Jul 2 00:46:34 2021 +0200

    ValidateTopology: improve speed of check for node's containing_face

diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index fcff96b..bae374c 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -1828,8 +1828,8 @@ BEGIN
     FROM node n
     LEFT JOIN face_check f ON ( ST_Contains(f.geom, n.geom) )
     LEFT JOIN edge e ON (
-      ST_Equals(ST_StartPoint(e.geom), n.geom) OR
-      ST_Equals(ST_EndPoint(e.geom), n.geom)
+      e.start_node = n.node_id OR
+      e.end_node = n.node_id
     )
     WHERE
      ( bbox IS NULL OR n.geom && bbox )

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

Summary of changes:
 NEWS                                          |  1 +
 topology/test/invalid_topology.sql            |  3 ++-
 topology/test/regress/legacy_invalid_expected |  6 ++++-
 topology/topology.sql.in                      | 37 +++++++++++++++++++--------
 4 files changed, 34 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list