[SCM] PostGIS branch stable-3.4 updated. 3.4.2-35-g1f5caafe8

git at osgeo.org git at osgeo.org
Mon Apr 29 08:47:37 PDT 2024


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.4 has been updated
       via  1f5caafe8ad97f55372c2f56ef7745fcd5c8ee9c (commit)
      from  399a9ead7f2baf12717c5bcb4561409073284308 (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 1f5caafe8ad97f55372c2f56ef7745fcd5c8ee9c
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Mar 25 18:37:15 2024 +0100

    Have _lwt_CheckEdgeCrossing check for interior-boundary intersections
    
    So far only interior-interior intersections have been checked by
    the function, missing an important kind of invalid edge addition.
    
    References #5699 in stable-3.4 branch

diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index e21ddf007..317eabfe6 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -597,7 +597,9 @@ lwt_AddIsoNode( LWT_TOPOLOGY* topo, LWT_ELEMID face,
 	return _lwt_AddIsoNode( topo, face, pt, skipISOChecks, 1 );
 }
 
-/* Check that an edge does not cross an existing node or edge
+/*
+ * Check that an edge does not cross an existing node and
+ * does not have non-boundary intersection with existing edge
  *
  * @param myself the id of an edge to skip, if any
  *               (for ChangeEdgeGeom). Can use 0 for none.
@@ -691,7 +693,7 @@ _lwt_CheckEdgeCrossing( LWT_TOPOLOGY* topo,
 
     LWDEBUGF(2, "Edge %d converted to GEOS", edge_id);
 
-    /* check if the edge crosses our edge (not boundary-boundary) */
+    /* check if the edge has a non-boundary-boundary intersection with our edge */
 
     relate = GEOSRelateBoundaryNodeRule(eegg, edgegg, 2);
     if ( ! relate ) {
@@ -704,7 +706,7 @@ _lwt_CheckEdgeCrossing( LWT_TOPOLOGY* topo,
 
     LWDEBUGF(2, "Edge %d relate pattern is %s", edge_id, relate);
 
-    match = GEOSRelatePatternMatch(relate, "F********");
+    match = GEOSRelatePatternMatch(relate, "FF*F*****");
     if ( match ) {
       /* error or no interior intersection */
       GEOSGeom_destroy(eegg);
@@ -763,11 +765,42 @@ _lwt_CheckEdgeCrossing( LWT_TOPOLOGY* topo,
       return -1;
     }
 
+    match = GEOSRelatePatternMatch(relate, "*T*******");
+    if ( match ) {
+      _lwt_release_edges(edges, num_edges);
+      GEOSGeom_destroy(edgegg);
+      GEOSGeom_destroy(eegg);
+      GEOSFree(relate);
+      if ( match == 2 ) {
+        lwerror("GEOSRelatePatternMatch error: %s", lwgeom_geos_errmsg);
+      } else {
+        lwerror("Spatial exception - geometry boundary touches interior of edge %"
+                LWTFMT_ELEMID, edge_id);
+      }
+      return -1;
+    }
+
+    match = GEOSRelatePatternMatch(relate, "***T*****");
+    if ( match ) {
+      _lwt_release_edges(edges, num_edges);
+      GEOSGeom_destroy(edgegg);
+      GEOSGeom_destroy(eegg);
+      GEOSFree(relate);
+      if ( match == 2 ) {
+        lwerror("GEOSRelatePatternMatch error: %s", lwgeom_geos_errmsg);
+      } else {
+        lwerror("Spatial exception - boundary of edge % touches interior of geometry"
+                LWTFMT_ELEMID, edge_id);
+      }
+      return -1;
+    }
+
     LWDEBUGF(2, "Edge %d analisys completed, it does no harm", edge_id);
 
     GEOSFree(relate);
     GEOSGeom_destroy(eegg);
   }
+  LWDEBUGF(1, "No edge crossing detected among the %d candidate edges", num_edges);
   if ( edges ) _lwt_release_edges(edges, num_edges);
               /* would be NULL if num_edges was 0 */
 

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

Summary of changes:
 liblwgeom/lwgeom_topo.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list