[postgis-tickets] [SCM] PostGIS branch stable-3.1 updated. 3.1.1-27-g792a90a

git at osgeo.org git at osgeo.org
Tue Mar 9 19:56:41 PST 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, stable-3.1 has been updated
       via  792a90a7ac016fdaff1781f1192f6b62f7cf611c (commit)
      from  2239a5c8efab280050163de6453f055346d69375 (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 792a90a7ac016fdaff1781f1192f6b62f7cf611c
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Mar 3 22:45:57 2021 +0100

    References #4837 for PostGIS 3.1

diff --git a/topology/sql/populate.sql.in b/topology/sql/populate.sql.in
index 7974182..38a83fa 100644
--- a/topology/sql/populate.sql.in
+++ b/topology/sql/populate.sql.in
@@ -293,15 +293,53 @@ BEGIN
 	      RETURN rec.edge_id;
 	  END IF;
 
-	  -- WARNING: the constructive operation might throw an exception
-	  BEGIN
-	    ix = ST_Intersection(rec.geom, aline);
-	  EXCEPTION
-	  WHEN OTHERS THEN
-	    RAISE NOTICE 'Could not compute intersection between input edge (%) and edge % (%)', aline::text, rec.edge_id, rec.geom::text;
-	  END;
-
-	  RAISE EXCEPTION 'Edge intersects (not on endpoints) with existing edge % at or near point %', rec.edge_id, ST_AsText(ST_PointOnSurface(ix));
+    -- WARNING: the constructive operation might throw an exception
+    BEGIN
+      ix = ST_Intersection(rec.geom, aline);
+    EXCEPTION
+    WHEN OTHERS THEN
+      RAISE NOTICE
+        'Could not compute intersection between'
+          ' input edge (%) and edge % (%)',
+        aline::text,
+        rec.edge_id,
+        rec.geom::text;
+    END;
+
+    -- Find a point on the intersection which
+    -- is NOT an endpoint of "aline"
+    IF ST_Dimension(ix) = 0
+    THEN
+      WITH SharedBounds AS (
+        (
+          SELECT ST_Force2D(ST_StartPoint(rec.geom)) g
+          UNION
+          SELECT ST_Force2D(ST_EndPoint(rec.geom))
+        )
+        INTERSECT
+        (
+          SELECT ST_Force2D(ST_StartPoint(aline))
+          UNION
+          SELECT ST_Force2D(ST_EndPoint(aline))
+        )
+      )
+      SELECT d.geom
+      FROM ST_DumpPoints(ix) d
+      WHERE ST_Force2D(geom) NOT IN ( SELECT g FROM SharedBounds )
+      ORDER BY d.path
+      LIMIT 1
+      INTO STRICT ix;
+    ELSE
+      -- for linear intersection we pick
+      -- an internal point.
+      ix := ST_PointOnSurface(ix);
+    END IF;
+
+    RAISE EXCEPTION
+      'Edge intersects (not on endpoints)'
+        ' with existing edge % at or near point %',
+      rec.edge_id,
+      ST_AsText(ix);
 
 	END LOOP;
 
diff --git a/topology/test/regress/addedge_expected b/topology/test/regress/addedge_expected
index 39be89d..19f7a2a 100644
--- a/topology/test/regress/addedge_expected
+++ b/topology/test/regress/addedge_expected
@@ -17,8 +17,8 @@ e5|5
 e6|6
 #770-1|7
 #770-2|8
-ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(8 10)
-ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(8 10)
+ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(10 12)
+ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(10 12)
 ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point POINT(10 12)
 #770-1*|7
 1|0|0|-1|1|LINESTRING(0 0,8 0)

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

Summary of changes:
 topology/sql/populate.sql.in           | 56 ++++++++++++++++++++++++++++------
 topology/test/regress/addedge_expected |  4 +--
 2 files changed, 49 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list