[geos-commits] [SCM] GEOS branch main updated. 2e12fa312d8ed12b36839ef20c193b49d695f1d4

git at osgeo.org git at osgeo.org
Thu Oct 9 14:36:49 PDT 2025


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  2e12fa312d8ed12b36839ef20c193b49d695f1d4 (commit)
      from  0db400d33d14bdbb0ab3b6d749b886996d02c67a (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 2e12fa312d8ed12b36839ef20c193b49d695f1d4
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Oct 9 14:36:26 2025 -0700

    Use GeometryFixer in place of buffer(0) in GeometrySnapper::snapToSelf

diff --git a/src/operation/overlay/snap/GeometrySnapper.cpp b/src/operation/overlay/snap/GeometrySnapper.cpp
index a2aed6eaa..7a13005f5 100644
--- a/src/operation/overlay/snap/GeometrySnapper.cpp
+++ b/src/operation/overlay/snap/GeometrySnapper.cpp
@@ -20,6 +20,7 @@
 #include <geos/operation/overlay/snap/GeometrySnapper.h>
 #include <geos/operation/overlay/snap/LineStringSnapper.h>
 #include <geos/geom/util/GeometryTransformer.h> // inherit. of SnapTransformer
+#include <geos/geom/util/GeometryFixer.h>
 #include <geos/geom/CoordinateSequence.h>
 #include <geos/geom/Polygon.h>
 #include <geos/geom/MultiPolygon.h>
@@ -130,12 +131,11 @@ GeometrySnapper::snapToSelf(double snapTolerance, bool cleanResult)
     // (we need a pointer for dynamic polymorphism)
     std::unique_ptr<GeometryTransformer> snapTrans(new SnapTransformer(snapTolerance, *snapPts));
 
-    GeomPtr result = snapTrans->transform(&srcGeom);
+    std::unique_ptr<Geometry> result = snapTrans->transform(&srcGeom);
 
-    if(cleanResult && (dynamic_cast<const Polygon*>(result.get()) ||
-                       dynamic_cast<const MultiPolygon*>(result.get()))) {
-        // TODO: use better cleaning approach
-        result = result->buffer(0);
+    if (cleanResult && (result->getGeometryTypeId() == GEOS_POLYGON ||
+                        result->getGeometryTypeId() == GEOS_MULTIPOLYGON)) {
+        result = geom::util::GeometryFixer::fix(result.get());
     }
 
     return result;

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

Summary of changes:
 src/operation/overlay/snap/GeometrySnapper.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list