[postgis-tickets] [SCM] PostGIS branch stable-2.4 updated. 2.4.9-2-g79ea7bb

git at osgeo.org git at osgeo.org
Mon Sep 21 05:59:21 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.4 has been updated
       via  79ea7bb37269ef23bbbdae38a3cec96a248ce9a7 (commit)
      from  8a251bdf65ec45614d119d74e6c2a4613e5b7927 (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 79ea7bb37269ef23bbbdae38a3cec96a248ce9a7
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
    
    Closes #4757 in 2.4 branch (2.4.10dev)
    Includes regression test

diff --git a/NEWS b/NEWS
index 79f15fb..47e1f48 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+PostGIS 2.4.10dev
+YYYY/MM/DD
+
+  * Bug Fixes and Enhancements *
+
+  - #4757, Handle line collapse due to snap-to-existing node (Sandro Santilli)
+
 PostGIS 2.4.9
 2020/08/14
 
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index c55f949..31b0e4d 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -5575,6 +5575,14 @@ _lwt_AddLineEdge( LWT_TOPOLOGY* topo, LWLINE* edge, double tol )
     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 83397d0..4a6cf06 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -332,3 +332,10 @@ SELECT 't3371.L2', topology.TopoGeo_AddLineString( 'bug3711',
 'LINESTRING (618370 4833780 1.92, 618370 4833784 1.90, 618371 4833780 1.93)'
 ::geometry, 0);
 SELECT 't3371.end', topology.DropTopology('bug3711');
+
+-- 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_newsnap b/topology/test/regress/topogeo_addlinestring_expected_newsnap
index 475bb75..b72c972 100644
--- a/topology/test/regress/topogeo_addlinestring_expected_newsnap
+++ b/topology/test/regress/topogeo_addlinestring_expected_newsnap
@@ -206,3 +206,6 @@ t3371.L1|1
 t3371.L2|3
 t3371.L2|2
 t3371.end|Topology 'bug3711' dropped
+t4757.start|t
+t4757.0|1
+t4757.end|Topology 'bug4757' dropped
diff --git a/topology/test/regress/topogeo_addlinestring_expected_oldsnap b/topology/test/regress/topogeo_addlinestring_expected_oldsnap
index f3e29c3..5e695d0 100644
--- a/topology/test/regress/topogeo_addlinestring_expected_oldsnap
+++ b/topology/test/regress/topogeo_addlinestring_expected_oldsnap
@@ -203,3 +203,6 @@ t3371.L1|1
 t3371.L2|3
 t3371.L2|2
 t3371.end|Topology 'bug3711' 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              | 7 +++++++
 topology/test/regress/topogeo_addlinestring_expected_newsnap | 3 +++
 topology/test/regress/topogeo_addlinestring_expected_oldsnap | 3 +++
 5 files changed, 28 insertions(+)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list