[postgis-tickets] [SCM] PostGIS branch stable-2.5 updated. 2.5.5-4-g4c8a707

git at osgeo.org git at osgeo.org
Mon Sep 21 05:39:48 PDT 2020


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-2.5 has been updated
       via  4c8a7077d62de5eeb068b9aa271c7deab2276297 (commit)
      from  15700cf4312c446cfd2d2ff448795850f53fe5eb (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 4c8a7077d62de5eeb068b9aa271c7deab2276297
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Sep 21 12:59:29 2020 +0200

    Handle line collapse due to snap-to-existing node
    
    References #4757 in 2.5 branch (2.5.6dev)
    Includes regression test

diff --git a/NEWS b/NEWS
index 1179a49..140a60d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+PostGIS 2.5.6dev
+YYYY/MM/DD
+
+ * Bug fixes *
+
+  - #4757, Handle line collapse due to snap-to-existing node (Sandro Santilli)
+
 PostGIS 2.5.5
 2020/08/15
 
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 308f64e..1883969 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -5452,6 +5452,14 @@ _lwt_AddLineEdge( LWT_TOPOLOGY* topo, LWLINE* edge, double tol,
     if ( tmp ) lwgeom_free(tmp);
     tmp = tmp2;
 
+    /* check if the so-decimated edge collapsed to single-point */
+    if ( nid[0] == nid[1] && edge->points->npoints == 2 )
+    {
+      lwgeom_free(tmp);
+      LWDEBUG(1, "Repeated-point removed edge collapsed");
+      return 0;
+    }
+
     /* check if the so-decimated edge _now_ exists */
     id = _lwt_GetEqualEdge ( topo, edge );
     LWDEBUGF(1, "_lwt_GetEqualEdge returned %" LWTFMT_ELEMID, id);
diff --git a/topology/test/regress/topogeo_addlinestring.sql b/topology/test/regress/topogeo_addlinestring.sql
index f53f583..2bc1061 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -36,7 +36,7 @@ BEGIN
   -- Check effect on edges (there should be one split)
   sql := 'WITH node_limits AS ( SELECT max FROM city_data.limits WHERE what = ''node''::text ),
        edge_limits AS ( SELECT max FROM city_data.limits WHERE what = ''edge''::text )
-  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' || 
+  SELECT $1 || ''|E|'' ' || CASE WHEN add_id THEN ' || e.edge_id || ''|sn'' || e.start_node || ''|en'' || e.end_node::text ' ELSE '' END || ' AS xx ' ||
    ' FROM city_data.edge e, node_limits nl, edge_limits el
    WHERE e.start_node > nl.max
       OR e.end_node > nl.max
@@ -333,7 +333,7 @@ SELECT 't3412.L1', TopoGeo_AddLinestring('bug3412',
 /**SELECT 't3412.L2', TopoGeo_AddLinestring('bug3412',
 '0102000000020000003AB42BBFEE4C22410010C5A997A6524167BB5DBDEE4C224117FE3DA85FA75241'
 ::geometry, 0);**/
-SELECT 't3412.L2', COUNT(*) 
+SELECT 't3412.L2', COUNT(*)
 FROM TopoGeo_AddLinestring('bug3412',
 '0102000000020000003AB42BBFEE4C22410010C5A997A6524167BB5DBDEE4C224117FE3DA85FA75241'
 ::geometry, 0);
@@ -365,7 +365,7 @@ SELECT 't3838.L1', topology.TopoGeo_addLinestring('bug3838',
 /** SELECT 't3838.L2', topology.TopoGeo_addLinestring('bug3838',
 'LINESTRING(622608 6554988, 622596 6554984)'
 ::geometry , 10);**/
-SELECT 't3838.L2', COUNT(*) 
+SELECT 't3838.L2', COUNT(*)
   FROM topology.TopoGeo_addLinestring('bug3838',
 'LINESTRING(622608 6554988, 622596 6554984)'
 ::geometry , 10);
@@ -385,3 +385,9 @@ SELECT 't1855_2.1', topology.topogeo_AddLinestring('bug1855',
   'LINESTRING(10 51, -100 50, 10 49)', 2);
 SELECT 't1855_2.end', topology.DropTopology('bug1855');
 
+-- See https://trac.osgeo.org/postgis/ticket/4757
+SELECT 't4757.start', topology.CreateTopology('bug4757') > 0;
+SELECT 't4757.0', topology.TopoGeo_addPoint('bug4757', 'POINT(0 0)');
+SELECT 't4757.1', topology.TopoGeo_addLinestring('bug4757',
+  'LINESTRING(0 -0.1,1 0,1 1,0 1,0 -0.1)', 1);
+SELECT 't4757.end', topology.DropTopology('bug4757');
diff --git a/topology/test/regress/topogeo_addlinestring_expected b/topology/test/regress/topogeo_addlinestring_expected
index d980332..7352a02 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -214,3 +214,6 @@ t1855_2.1|3
 t1855_2.1|5
 t1855_2.1|6
 t1855_2.end|Topology 'bug1855' dropped
+t4757.start|t
+t4757.0|1
+t4757.end|Topology 'bug4757' dropped

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

Summary of changes:
 NEWS                                                 |  7 +++++++
 liblwgeom/lwgeom_topo.c                              |  8 ++++++++
 topology/test/regress/topogeo_addlinestring.sql      | 12 +++++++++---
 topology/test/regress/topogeo_addlinestring_expected |  3 +++
 4 files changed, 27 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list