[SCM] PostGIS branch stable-3.1 updated. 3.1.11-4-g50abdc26d

git at osgeo.org git at osgeo.org
Tue May 7 00:28:24 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.1 has been updated
       via  50abdc26dbecdcd4e0019c0100638b1c184ee3f1 (commit)
      from  e9437f041b415917587144d45f54ac7b4da6ae07 (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 50abdc26dbecdcd4e0019c0100638b1c184ee3f1
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.
    
    in stable-3.1 branch (3.1.12):
    
    References #5699
    References #5711
    References #5722

diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 8b3690554..8fab550e2 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -583,7 +583,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.
@@ -677,7 +679,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 ) {
@@ -690,7 +692,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);
@@ -749,11 +751,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