[geos-commits] [SCM] GEOS branch main updated. a4b9ba7d70b4e46143377b4013789f7534033958

git at osgeo.org git at osgeo.org
Thu Jun 25 09:26:29 PDT 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  a4b9ba7d70b4e46143377b4013789f7534033958 (commit)
      from  2c89410f5c6aef61a3f0d72a29c1f88cfb3573a4 (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 a4b9ba7d70b4e46143377b4013789f7534033958
Author: Daniel Baston <dbaston at gmail.com>
Date:   Thu Jun 25 12:26:08 2026 -0400

    GeometrySplitter: Return input CompoundCurve when split line is disjoint (#1457)
    
    Resolves https://github.com/libgeos/geos/issues/1456

diff --git a/src/operation/split/GeometrySplitter.cpp b/src/operation/split/GeometrySplitter.cpp
index e78fffef9..904f01081 100644
--- a/src/operation/split/GeometrySplitter.cpp
+++ b/src/operation/split/GeometrySplitter.cpp
@@ -289,11 +289,17 @@ GeometrySplitter::splitLinealWithEdge(const Geometry &geom, const Geometry &edge
     noder.setOnlyFirstGeomEdges(true);
     noder.setPreserveCompoundCurves(true);
 
-    auto nodedMLS = noder.getNoded();
+    auto noded = noder.getNoded();
 
-    auto nodedGC = geom.getFactory()->createGeometryCollection(detail::down_cast<GeometryCollection*>(nodedMLS.get())->releaseGeometries());
+    // Already a collection type? Convert to a generic GeometryCollection and return.
+    if (auto* coll = dynamic_cast<GeometryCollection*>(noded.get())) {
+        return geom.getFactory()->createGeometryCollection(coll->releaseGeometries());
+    }
 
-    return nodedGC;
+    // Promote single-part geometries to a collection type
+    std::vector<std::unique_ptr<Geometry>> geoms;
+    geoms.push_back(std::move(noded));
+    return geom.getFactory()->createGeometryCollection(std::move(geoms));
 }
 
 static std::unique_ptr<Point>
diff --git a/tests/unit/operation/split/GeometrySplitterTest.cpp b/tests/unit/operation/split/GeometrySplitterTest.cpp
index 526144e03..2fa6f7767 100644
--- a/tests/unit/operation/split/GeometrySplitterTest.cpp
+++ b/tests/unit/operation/split/GeometrySplitterTest.cpp
@@ -848,4 +848,26 @@ void object::test<69>()
         "GEOMETRYCOLLECTION (LINESTRING (-10 0, -8 0), LINESTRING (-8 0, -5 0), COMPOUNDCURVE (CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 8 0)), LINESTRING (8 0, 10 0), CIRCULARSTRING (10 0, 15 -5, 20 0))");
 }
 
+template<>
+template<>
+void object::test<70>()
+{
+    set_test_name("split CompoundCurve with disjoint LineString");
+
+    testSplit("COMPOUNDCURVE ((-10 0, -5 0), CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 10 0))",
+              "LINESTRING (0 0, 0 4)",
+              "GEOMETRYCOLLECTION(COMPOUNDCURVE ((-10 0, -5 0), CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 10 0)))");
+}
+
+template<>
+template<>
+void object::test<71>()
+{
+    set_test_name("split CompoundCurve with disjoint Point");
+
+    testSplit("COMPOUNDCURVE ((-10 0, -5 0), CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 10 0))",
+              "POINT (0 0)",
+              "GEOMETRYCOLLECTION(COMPOUNDCURVE ((-10 0, -5 0), CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, 10 0)))");
+}
+
 }

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

Summary of changes:
 src/operation/split/GeometrySplitter.cpp           | 12 +++++++++---
 .../unit/operation/split/GeometrySplitterTest.cpp  | 22 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list