[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.2-10-g12df1cfd4

git at osgeo.org git at osgeo.org
Tue Dec 13 02:24:36 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.3 has been updated
       via  12df1cfd409d85d5a42dcd4c0e17f9603a6d5bb5 (commit)
      from  c25b6a79224945900322d1692a9598f10e1fd644 (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 12df1cfd409d85d5a42dcd4c0e17f9603a6d5bb5
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
    
    Closes #5303 in 3.3 branch (3.3.3dev)
    Includes test.

diff --git a/NEWS b/NEWS
index 8ef851e27..ee0b1b2e2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,10 @@ PostGIS 3.3.3dev
 YYYY/MM/DD
 
 * Bug Fixes *
-  - #5289, Fix misleading message about doubly connected edges healing (Sandro Santilli)
+  - #5303, Don't try removing closed edges endpoint from
+           RemoveUnusedPrimitives (Sandro Santilli)
+  - #5289, Fix misleading message in RemoveUnusedPrimitives about
+           doubly connected edges healing (Sandro Santilli)
   - #5298, Fix CopyTopology exception with hierarchical layers (Sandro Santilli)
   - #5299, Corrections to address_standardizer_data_us lex (Regina Obe)
 
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:
 NEWS                                                  |  5 ++++-
 topology/sql/cleanup/RemoveUnusedPrimitives.sql.in    |  8 +++++++-
 topology/test/regress/removeunusedprimitives.sql      | 19 +++++++++++++++++++
 topology/test/regress/removeunusedprimitives_expected |  2 ++
 4 files changed, 32 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list