[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-68-g1e8036c

git at osgeo.org git at osgeo.org
Mon Sep 21 04:00:39 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, master has been updated
       via  1e8036c222bf316c7f28a4387f5c8833dff6bd94 (commit)
      from  0850fe602dcb9dca7231b4e1ca091fc115109c68 (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 1e8036c222bf316c7f28a4387f5c8833dff6bd94
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 master branch (3.1.0dev)
    Includes regression test

diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index c45c4c0..236a292 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -5480,6 +5480,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 b57f78a..460229a 100644
--- a/topology/test/regress/topogeo_addlinestring.sql
+++ b/topology/test/regress/topogeo_addlinestring.sql
@@ -34,7 +34,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
@@ -330,7 +330,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);
@@ -362,7 +362,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);
@@ -382,3 +382,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 5ff1a97..8f75e7c 100644
--- a/topology/test/regress/topogeo_addlinestring_expected
+++ b/topology/test/regress/topogeo_addlinestring_expected
@@ -212,3 +212,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:
 liblwgeom/lwgeom_topo.c                              |  8 ++++++++
 topology/test/regress/topogeo_addlinestring.sql      | 12 +++++++++---
 topology/test/regress/topogeo_addlinestring_expected |  3 +++
 3 files changed, 20 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list