[geos-commits] [SCM] GEOS branch main updated. 3dde4d59eb6fc1d142378642e2affde328e57f0d

git at osgeo.org git at osgeo.org
Sat Jan 17 06:05:59 PST 2026


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 "GEOS".

The branch, main has been updated
       via  3dde4d59eb6fc1d142378642e2affde328e57f0d (commit)
      from  3b391278f7844f16968e9397dd507c95589ac647 (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 3dde4d59eb6fc1d142378642e2affde328e57f0d
Author: arriopolis <arjan_rekenmachine at hotmail.com>
Date:   Sat Jan 17 06:05:31 2026 -0800

    Added a spatial index to the overlayng polygonbuilder (#1379)
    
    * added a spatial index to the overlayng polygonbuilder
    
    * Updated spelling.
    
    * reuse spatial filter result vector

diff --git a/src/operation/overlayng/PolygonBuilder.cpp b/src/operation/overlayng/PolygonBuilder.cpp
index abdb4a0fb..8cc88d306 100644
--- a/src/operation/overlayng/PolygonBuilder.cpp
+++ b/src/operation/overlayng/PolygonBuilder.cpp
@@ -168,11 +168,21 @@ PolygonBuilder::assignHoles(OverlayEdgeRing* shell, const std::vector<OverlayEdg
 void
 PolygonBuilder::placeFreeHoles(const std::vector<OverlayEdgeRing*>& shells, const std::vector<OverlayEdgeRing*> & freeHoles) const
 {
-    // TODO: use a spatial index to improve performance
+    // build spatial index
+    index::strtree::TemplateSTRtree<OverlayEdgeRing*> index;
+    for (auto& shell : shells) {
+        index.insert(*shell->getRingPtr()->getEnvelopeInternal(), shell);
+    }
+
+    std::vector<OverlayEdgeRing*> shellListOverlaps;
     for (OverlayEdgeRing* hole : freeHoles) {
         // only place this hole if it doesn't yet have a shell
         if (hole->getShell() == nullptr) {
-            OverlayEdgeRing* shell = hole->findEdgeRingContaining(shells);
+            // get list of overlapping shells
+            shellListOverlaps.clear();
+            index.query(*hole->getRingPtr()->getEnvelopeInternal(), shellListOverlaps);
+
+            OverlayEdgeRing* shell = hole->findEdgeRingContaining(shellListOverlaps);
             // only when building a polygon-valid result
             if (isEnforcePolygonal && shell == nullptr) {
                 throw util::TopologyException("unable to assign free hole to a shell", hole->getCoordinate());

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

Summary of changes:
 src/operation/overlayng/PolygonBuilder.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list