[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.1-7-gefe02efd8

git at osgeo.org git at osgeo.org
Wed Mar 2 05:54:29 PST 2022


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.2 has been updated
       via  efe02efd87d17cb1cfe09ae3003fb0b8ea5e3f79 (commit)
      from  8751ae638b369583fd7afedb1edd67c014c4b657 (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 efe02efd87d17cb1cfe09ae3003fb0b8ea5e3f79
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Feb 28 16:30:44 2022 +0100

    Never consider rings composed of only dangling edges as a shell
    
    Works around a robustness issue with ptarray_is_ccw
    Closes #5105 in 3.2 branch (3.2.2dev)
    Includes NEWS entry

diff --git a/NEWS b/NEWS
index cde01c996..74299d9de 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PostGIS 3.2.2dev
 2022/MM/DD
 
 * Bug Fixes *
+  - #5105, Fix false invalidity report from ValidateTopology
+           (Sandro Santilli)
   - #5097, Ensure spatial index is used during topology population
            at the getClosestEdge step (Sandro Santilli)
   - #5091, Fix --without-protobuf builds (Tobias Bussmann)
diff --git a/topology/sql/manage/ValidateTopology.sql.in b/topology/sql/manage/ValidateTopology.sql.in
index 5d8c1c576..a59a145f6 100644
--- a/topology/sql/manage/ValidateTopology.sql.in
+++ b/topology/sql/manage/ValidateTopology.sql.in
@@ -474,14 +474,16 @@ BEGIN
           ELSE
             e.right_face
           END
-        ) side_faces
+        ) side_faces,
+        count(signed_edge_id) num_edges,
+        count(distinct abs(signed_edge_id)) distinct_edges
       FROM
         all_rings_with_ring_ordinal_edge r,
         edge_data e
       WHERE e.edge_id = abs(r.signed_edge_id)
       GROUP BY ring_id
     ) --}{
-    SELECT ring_id, geom as ring_geom, side_faces
+    SELECT ring_id, geom as ring_geom, side_faces, distinct_edges, num_edges
     FROM all_rings_with_ring_geom
   LOOP --}{
 
@@ -511,6 +513,9 @@ BEGIN
     END IF; --}
 
     --RAISE DEBUG 'Ring geom: %', ST_AsTexT(rec.ring_geom);
+    --RAISE DEBUG 'Distinct edges: %', rec.distinct_edges;
+    --RAISE DEBUG 'Num edges: %', rec.num_edges;
+
     IF NOT ST_Equals(
       ST_StartPoint(rec.ring_geom),
       ST_EndPoint(rec.ring_geom)
@@ -527,7 +532,9 @@ BEGIN
 
     -- Ring is valid, save it.
     is_shell := false;
-    IF ST_NPoints(rec.ring_geom) > 3 THEN
+    IF ST_NPoints(rec.ring_geom) > 3 AND
+       rec.num_edges != rec.distinct_edges * 2
+    THEN
       ring_poly := ST_MakePolygon(rec.ring_geom);
       IF ST_IsPolygonCCW(ring_poly) THEN
         is_shell := true;
diff --git a/topology/test/regress/validatetopology.sql b/topology/test/regress/validatetopology.sql
index 2d7caeaa5..b41ce9859 100644
--- a/topology/test/regress/validatetopology.sql
+++ b/topology/test/regress/validatetopology.sql
@@ -156,5 +156,31 @@ SELECT '#5017.2', (ValidateTopology('city_data')).error;
 SELECT '#5017.3', (ValidateTopology('city_data')).error;
 ROLLBACK;
 
+-- Test dangling edgerings are never considered shells
+-- See https://trac.osgeo.org/postgis/ticket/5105
+BEGIN;
+SELECT NULL FROM CreateTopology('t5105');
+SELECT '#5105.0', TopoGeo_addLineString('t5105', '
+LINESTRING(
+  29.262792863298348 71.22115103790775,
+  29.26598031986849  71.22202978558047,
+  29.275379947735576 71.22044935739267,
+  29.29461024331857  71.22741507590429,
+  29.275379947735576 71.22044935739267,
+  29.26598031986849  71.22202978558047,
+  29.262792863298348 71.22115103790775
+)');
+SELECT '#5105.1', TopoGeo_addLineString(
+  't5105',
+  ST_Translate(geom, 0, -2)
+)
+FROM t5105.edge WHERE edge_id = 1;
+SELECT '#5105.edges_count', count(*) FROM t5105.edge;
+SELECT '#5105.faces_count', count(*) FROM t5105.face WHERE face_id > 0;
+SELECT '#5105.unexpected_invalidities', * FROM ValidateTopology('t5105');
+-- TODO: add some areas to the endpoints of the dangling edges above
+--       to form O-O figures
+ROLLBACK;
+
 SELECT NULL FROM topology.DropTopology('city_data');
 
diff --git a/topology/test/regress/validatetopology_expected b/topology/test/regress/validatetopology_expected
index 9a19cc6c2..f91c3cbe9 100644
--- a/topology/test/regress/validatetopology_expected
+++ b/topology/test/regress/validatetopology_expected
@@ -33,3 +33,7 @@
 #4830.5|hole not in advertised face|-26|
 #5017.2|mixed face labeling in ring
 #5017.3|mixed face labeling in ring
+#5105.0|1
+#5105.1|2
+#5105.edges_count|2
+#5105.faces_count|0

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

Summary of changes:
 NEWS                                            |  2 ++
 topology/sql/manage/ValidateTopology.sql.in     | 13 ++++++++++---
 topology/test/regress/validatetopology.sql      | 26 +++++++++++++++++++++++++
 topology/test/regress/validatetopology_expected |  4 ++++
 4 files changed, 42 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list