[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-109-g289bb48

git at osgeo.org git at osgeo.org
Wed Mar 3 14:00:15 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, master has been updated
       via  289bb4842d039b7ed6abc7180d2208c0a9ef474c (commit)
      from  30498d430684c0a7e7937a2efcada81980d49bb7 (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 289bb4842d039b7ed6abc7180d2208c0a9ef474c
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Mar 3 22:45:57 2021 +0100

    Do not rely on ST_PointOnSurface ( MULTIPOINT )
    
    The operation is not defined in that case, and different GEOS
    version can return different values.
    
    Closes #4864

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