[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-342-gfba9339

git at osgeo.org git at osgeo.org
Wed Jul 14 15:19:35 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  fba9339b0f21aed583e6e8bbe35d648756339568 (commit)
      from  168f3f431a9349d83728e7623f9388362eb6e169 (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 fba9339b0f21aed583e6e8bbe35d648756339568
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jul 15 00:17:02 2021 +0200

    Prevent healing edges if connecting node is used in mixed TopoGeometry
    
    Reference #3239
    
    NOTE: previous commit (168f3f431a9349d83728e7623f9388362eb6e169)
          closed ticket #3231 (iso nodes)

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index b5e6f5b..f51793a 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -2622,7 +2622,7 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
                     "r.layer_id, l.schema_name, l.table_name, l.feature_column, "
                     "array_agg(abs(r.element_id)) as elems FROM topology.layer l "
                     " INNER JOIN \"%s\".relation r ON (l.layer_id = r.layer_id) "
-                    "WHERE l.level = 0 and l.feature_type = 1 "
+                    "WHERE l.level = 0 and l.feature_type in ( 1, 4 ) "
                     "AND l.topology_id = %d"
                     " AND r.element_id = %" LWTFMT_ELEMID
                     " group by r.topogeo_id, r.layer_id, l.schema_name, "
@@ -2657,10 +2657,11 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
 
     cberror(topo->be_data, "TopoGeom %s in layer %s "
             "(%s.%s.%s) cannot be represented "
-            "healing edges %" LWTFMT_ELEMID
+            "removing node %" LWTFMT_ELEMID
+            " connecting edges %" LWTFMT_ELEMID
             " and %" LWTFMT_ELEMID,
             tg_id, layer_id, schema_name, table_name,
-            col_name, edge1, edge2);
+            col_name, rem_node, edge1, edge2);
     return 0;
   }
 
diff --git a/topology/test/regress/st_modedgeheal.sql b/topology/test/regress/st_modedgeheal.sql
index 782737f..842426a 100644
--- a/topology/test/regress/st_modedgeheal.sql
+++ b/topology/test/regress/st_modedgeheal.sql
@@ -62,16 +62,18 @@ SELECT topology.DropTopology('city_data');
 -- Now test in presence of features
 
 SELECT topology.CreateTopology('t') > 1;
-CREATE TABLE t.f(id varchar);
-SELECT 'line_layer', topology.AddTopoGeometryColumn('t', 't', 'f','g', 'LINE');
-CREATE TABLE t.p(id varchar);
-SELECT 'point_layer', topology.AddTopoGeometryColumn('t', 't', 'p','g', 'POINT');
+CREATE TABLE t.f_lin(id varchar);
+SELECT 'lin_layer', topology.AddTopoGeometryColumn('t', 't', 'f_lin','g', 'LINE');
+CREATE TABLE t.f_poi(id varchar);
+SELECT 'poi_layer', topology.AddTopoGeometryColumn('t', 't', 'f_poi','g', 'POINT');
+CREATE TABLE t.f_mix(id varchar);
+SELECT 'mix_layer', topology.AddTopoGeometryColumn('t', 't', 'f_mix','g', 'COLLECTION');
 
 SELECT 'N'||topology.TopoGeo_AddPoint('t', 'POINT(2 8)');  -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2 2, 2  8)');        -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
-INSERT INTO t.p VALUES ('F+N1',
+INSERT INTO t.f_poi VALUES ('F+N1',
   topology.CreateTopoGeom('t', 1, 2, '{{1,1}}'));
 
 -- This should be forbidden, as F+N1 above could not be
@@ -82,9 +84,30 @@ SELECT 'unexpected-success-with-orphaned-point-topogeom-1',
 SELECT 'unexpected-success-with-orphaned-point-topogeom-2',
   topology.ST_ModEdgeHeal('t', 2, 1);
 
-DELETE FROM t.p;
+WITH deleted AS (
+  DELETE FROM t.f_poi RETURNING g
+), clear AS (
+  SELECT ClearTopoGeom(g) FROM deleted
+) SELECT NULL FROM clear;
 
-INSERT INTO t.f VALUES ('F+E1',
+INSERT INTO t.f_mix VALUES ('F+N1',
+  topology.CreateTopoGeom('t', 4, 3, '{{1,1}}'));
+
+-- This should be forbidden, as F+N1 above could not be
+-- defined w/out the joining node
+-- See https://trac.osgeo.org/postgis/ticket/3239
+SELECT 'unexpected-success-with-orphaned-mix-topogeom-1',
+  topology.ST_ModEdgeHeal('t', 1, 2);
+SELECT 'unexpected-success-with-orphaned-mix-topogeom-2',
+  topology.ST_ModEdgeHeal('t', 2, 1);
+
+WITH deleted AS (
+  DELETE FROM t.f_mix RETURNING g
+), clear AS (
+  SELECT ClearTopoGeom(g) FROM deleted
+) SELECT NULL FROM clear;
+
+INSERT INTO t.f_lin VALUES ('F+E1',
   topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
 
 -- This should be forbidden, as F+E1 above could not be
@@ -101,13 +124,13 @@ SELECT topology.ST_ModEdgeHeal('t', 100, 2);
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 5 0)');         -- 3
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(10 0, 5 0)');        -- 4
 
-INSERT INTO t.f VALUES ('F+E3-E4',
+INSERT INTO t.f_lin VALUES ('F+E3-E4',
   topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}'));
-INSERT INTO t.f VALUES ('F-E3+E4',
+INSERT INTO t.f_lin VALUES ('F-E3+E4',
   topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}'));
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE
+  FROM t.relation r, t.f_lin f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id, r.element_id;
@@ -120,7 +143,7 @@ SELECT 'MH(3,4)', topology.ST_ModEdgeHeal('t', 3, 4);
 SELECT topology.ST_ModEdgeHeal('t', 1, 3);
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE
+  FROM t.relation r, t.f_lin f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id, r.element_id;
diff --git a/topology/test/regress/st_modedgeheal_expected b/topology/test/regress/st_modedgeheal_expected
index cab772a..1dfcb7b 100644
--- a/topology/test/regress/st_modedgeheal_expected
+++ b/topology/test/regress/st_modedgeheal_expected
@@ -96,15 +96,18 @@ N21
 N22
 Topology 'city_data' dropped
 t
-line_layer|1
-point_layer|2
+lin_layer|1
+poi_layer|2
+mix_layer|3
 N1
 E1
 E2
-ERROR:  TopoGeom 1 in layer 2 (t.p.g) cannot be represented healing edges 1 and 2
-ERROR:  TopoGeom 1 in layer 2 (t.p.g) cannot be represented healing edges 2 and 1
-ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 1 and 2
-ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 2 and 1
+ERROR:  TopoGeom 1 in layer 2 (t.f_poi.g) cannot be represented removing node 1 connecting edges 1 and 2
+ERROR:  TopoGeom 1 in layer 2 (t.f_poi.g) cannot be represented removing node 1 connecting edges 2 and 1
+ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1 connecting edges 1 and 2
+ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1 connecting edges 2 and 1
+ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 1 and 2
+ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 2 and 1
 ERROR:  SQL/MM Spatial exception - non-existent edge 200
 ERROR:  SQL/MM Spatial exception - non-existent edge 100
 E3
diff --git a/topology/test/regress/st_newedgeheal.sql b/topology/test/regress/st_newedgeheal.sql
index de4c218..6d4545d 100644
--- a/topology/test/regress/st_newedgeheal.sql
+++ b/topology/test/regress/st_newedgeheal.sql
@@ -62,29 +62,52 @@ SELECT topology.DropTopology('city_data');
 -- Now test in presence of features
 
 SELECT topology.CreateTopology('t') > 1;
-CREATE TABLE t.f(id varchar);
-SELECT 'line_layer', topology.AddTopoGeometryColumn('t', 't', 'f','g', 'LINE');
-CREATE TABLE t.p(id varchar);
-SELECT 'point_layer', topology.AddTopoGeometryColumn('t', 't', 'p','g', 'POINT');
+CREATE TABLE t.f_lin(id varchar);
+SELECT 'lin_layer', topology.AddTopoGeometryColumn('t', 't', 'f_lin','g', 'LINE');
+CREATE TABLE t.f_poi(id varchar);
+SELECT 'poi_layer', topology.AddTopoGeometryColumn('t', 't', 'f_poi','g', 'POINT');
+CREATE TABLE t.f_mix(id varchar);
+SELECT 'mix_layer', topology.AddTopoGeometryColumn('t', 't', 'f_mix','g', 'COLLECTION');
 
 SELECT 'N'||topology.TopoGeo_AddPoint('t', 'POINT(2 8)');  -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2 2, 2  8)');        -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
-INSERT INTO t.p VALUES ('F+N1',
+INSERT INTO t.f_poi VALUES ('F+N1',
   topology.CreateTopoGeom('t', 1, 2, '{{1,1}}'));
 
 -- This should be forbidden, as F+N1 above could not be
 -- defined w/out the joining node
 -- See https://trac.osgeo.org/postgis/ticket/3239
 SELECT 'unexpected-success-with-orphaned-point-topogeom-1',
-  topology.ST_ModEdgeHeal('t', 1, 2);
+  topology.ST_NewEdgeHeal('t', 1, 2);
 SELECT 'unexpected-success-with-orphaned-point-topogeom-2',
-  topology.ST_ModEdgeHeal('t', 2, 1);
+  topology.ST_NewEdgeHeal('t', 2, 1);
 
-DELETE FROM t.p;
+WITH deleted AS (
+  DELETE FROM t.f_poi RETURNING g
+), clear AS (
+  SELECT ClearTopoGeom(g) FROM deleted
+) SELECT NULL FROM clear;
 
-INSERT INTO t.f VALUES ('F+E1',
+INSERT INTO t.f_mix VALUES ('F+N1',
+  topology.CreateTopoGeom('t', 4, 3, '{{1,1}}'));
+
+-- This should be forbidden, as F+N1 above could not be
+-- defined w/out the joining node
+-- See https://trac.osgeo.org/postgis/ticket/3239
+SELECT 'unexpected-success-with-orphaned-mix-topogeom-1',
+  topology.ST_NewEdgeHeal('t', 1, 2);
+SELECT 'unexpected-success-with-orphaned-mix-topogeom-2',
+  topology.ST_NewEdgeHeal('t', 2, 1);
+
+WITH deleted AS (
+  DELETE FROM t.f_mix RETURNING g
+), clear AS (
+  SELECT ClearTopoGeom(g) FROM deleted
+) SELECT NULL FROM clear;
+
+INSERT INTO t.f_lin VALUES ('F+E1',
   topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
 
 -- This should be forbidden, as F+E1 above could not be
@@ -101,13 +124,13 @@ SELECT topology.ST_NewEdgeHeal('t', 100, 2);
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(0 0, 5 0)');         -- 3
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(10 0, 5 0)');        -- 4
 
-INSERT INTO t.f VALUES ('F+E3-E4',
+INSERT INTO t.f_lin VALUES ('F+E3-E4',
   topology.CreateTopoGeom('t', 2, 1, '{{3,2},{-4,2}}'));
-INSERT INTO t.f VALUES ('F-E3+E4',
+INSERT INTO t.f_lin VALUES ('F-E3+E4',
   topology.CreateTopoGeom('t', 2, 1, '{{-3,2},{4,2}}'));
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE
+  FROM t.relation r, t.f_lin f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id, r.element_id;
@@ -120,7 +143,7 @@ SELECT 'MH(3,4)', topology.ST_NewEdgeHeal('t', 3, 4);
 SELECT topology.ST_NewEdgeHeal('t', 1, 5);
 
 SELECT r.topogeo_id, r.element_id
-  FROM t.relation r, t.f f WHERE
+  FROM t.relation r, t.f_lin f WHERE
   r.layer_id = layer_id(f.g) AND r.topogeo_id = id(f.g)
   AND r.topogeo_id in (2,3)
   ORDER BY r.layer_id, r.topogeo_id, r.element_id;
diff --git a/topology/test/regress/st_newedgeheal_expected b/topology/test/regress/st_newedgeheal_expected
index a41313a..eb698a6 100644
--- a/topology/test/regress/st_newedgeheal_expected
+++ b/topology/test/regress/st_newedgeheal_expected
@@ -96,15 +96,18 @@ N21
 N22
 Topology 'city_data' dropped
 t
-line_layer|1
-point_layer|2
+lin_layer|1
+poi_layer|2
+mix_layer|3
 N1
 E1
 E2
-ERROR:  TopoGeom 1 in layer 2 (t.p.g) cannot be represented healing edges 1 and 2
-ERROR:  TopoGeom 1 in layer 2 (t.p.g) cannot be represented healing edges 2 and 1
-ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 1 and 2
-ERROR:  TopoGeom 1 in layer 1 (t.f.g) cannot be represented healing edges 2 and 1
+ERROR:  TopoGeom 1 in layer 2 (t.f_poi.g) cannot be represented removing node 1 connecting edges 1 and 2
+ERROR:  TopoGeom 1 in layer 2 (t.f_poi.g) cannot be represented removing node 1 connecting edges 2 and 1
+ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1 connecting edges 1 and 2
+ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1 connecting edges 2 and 1
+ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 1 and 2
+ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 2 and 1
 ERROR:  SQL/MM Spatial exception - non-existent edge 200
 ERROR:  SQL/MM Spatial exception - non-existent edge 100
 E3

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

Summary of changes:
 topology/postgis_topology.c                   |  7 ++--
 topology/test/regress/st_modedgeheal.sql      | 45 ++++++++++++++++++------
 topology/test/regress/st_modedgeheal_expected | 15 ++++----
 topology/test/regress/st_newedgeheal.sql      | 49 ++++++++++++++++++++-------
 topology/test/regress/st_newedgeheal_expected | 15 ++++----
 5 files changed, 92 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list