[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-622-g21ebc0ee1

git at osgeo.org git at osgeo.org
Wed Mar 2 05:43:05 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, master has been updated
       via  21ebc0ee162200268798e5bc7590a5d948acd9ba (commit)
      from  8108dd5fd31936f449d958629a5e503003b50b73 (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 21ebc0ee162200268798e5bc7590a5d948acd9ba
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
    References #5105 in master branch (3.3.0dev)

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 d18067dc6..215d23075 100644
--- a/topology/test/regress/validatetopology.sql
+++ b/topology/test/regress/validatetopology.sql
@@ -157,5 +157,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:
 topology/sql/manage/ValidateTopology.sql.in     | 13 ++++++++++---
 topology/test/regress/validatetopology.sql      | 26 +++++++++++++++++++++++++
 topology/test/regress/validatetopology_expected |  4 ++++
 3 files changed, 40 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list