[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-391-g8de2b5bb2

git at osgeo.org git at osgeo.org
Tue Dec 13 02:24:17 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  8de2b5bb2dd087ca457c730bc5576b18a77fc929 (commit)
      from  c2a0b202492a235002deaf3fd4a82cbeb659ea1a (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 8de2b5bb2dd087ca457c730bc5576b18a77fc929
Author: Sandro Santilli <strk at kbt.io>
Date:   Tue Dec 13 11:03:18 2022 +0100

    RemoveUnusedPrimitives: do not try removing nodes connecting closed edges
    
    References #5303 in master branch (3.4.0dev)
    Includes test.

diff --git a/topology/sql/cleanup/RemoveUnusedPrimitives.sql.in b/topology/sql/cleanup/RemoveUnusedPrimitives.sql.in
index 8f58d4008..69b6afcd8 100644
--- a/topology/sql/cleanup/RemoveUnusedPrimitives.sql.in
+++ b/topology/sql/cleanup/RemoveUnusedPrimitives.sql.in
@@ -580,7 +580,11 @@ BEGIN
       removable_nodes_of_degree_2_in_bbox AS (
         SELECT
           n.node_id,
-          array_agg(e.edge_id ORDER BY e.edge_id) edges
+          array_agg(
+            e.edge_id
+            -- order to make cleanup outcome predictable
+            ORDER BY e.edge_id
+          ) edges
         FROM
           unused_connected_nodes_in_bbox n,
           %1$I.edge e
@@ -590,6 +594,8 @@ BEGIN
           )
         GROUP BY n.node_id
         HAVING count(e.edge_id) = 2
+        -- Do not consider nodes used by closed edges as removable
+        AND NOT 't' = ANY( array_agg(e.start_node = e.end_node) )
       ),
       breaking_heals AS (
         SELECT
diff --git a/topology/test/regress/removeunusedprimitives.sql b/topology/test/regress/removeunusedprimitives.sql
index 345ba9f23..1581c27f2 100644
--- a/topology/test/regress/removeunusedprimitives.sql
+++ b/topology/test/regress/removeunusedprimitives.sql
@@ -221,8 +221,27 @@ SELECT '#5289', 'clean', topology.RemoveUnusedPrimitives('city_data');
 SELECT '#5289', 'changed', * FROM features.check_changed_features();
 SELECT '#5289', 'invalidity', * FROM topology.ValidateTopology('city_data');
 
+--
+-- See https://trac.osgeo.org/postgis/ticket/5303
+--
 
+-- Extend lineal feature R4 to include usage of edge 2
+-- so that node X becomes "unused" (if it wasn't for
+-- being required as endpoint of closed edge 2) while
+-- edges themselves would still be both used by R4 feature.
+UPDATE features.city_streets
+SET feature = TopoGeom_addElement(feature, ARRAY[2, 2])
+WHERE feature_name = 'R4';
+
+SELECT '#5303', 'clean', topology.RemoveUnusedPrimitives('city_data');
+SELECT '#5303', 'changed', * FROM features.check_changed_features();
+SELECT '#5303', 'invalidity', * FROM topology.ValidateTopology('city_data');
+
+
+--
 -- Cleanup
+--
+
 SELECT NULL FROM DropTopology('city_data');
 DROP SCHEMA features CASCADE;
 
diff --git a/topology/test/regress/removeunusedprimitives_expected b/topology/test/regress/removeunusedprimitives_expected
index 400adf603..802833399 100644
--- a/topology/test/regress/removeunusedprimitives_expected
+++ b/topology/test/regress/removeunusedprimitives_expected
@@ -8,3 +8,5 @@ t4|clean|1
 t5|clean|2
 t6|clean|3
 #5289|clean|1
+#5303|clean|0
+#5303|changed|lineal|R4|MULTILINESTRING((25 30,25 35))|MULTILINESTRING((25 30,31 30,31 40,17 40,17 30,25 30),(25 30,25 35))|LINESTRING(25 30,31 30,31 40,17 40,17 30,25 30)

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

Summary of changes:
 topology/sql/cleanup/RemoveUnusedPrimitives.sql.in    |  8 +++++++-
 topology/test/regress/removeunusedprimitives.sql      | 19 +++++++++++++++++++
 topology/test/regress/removeunusedprimitives_expected |  2 ++
 3 files changed, 28 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list