[geos-commits] [SCM] GEOS branch main updated. 29d4f5d030293a9b8254022266e0789a2badc726
git at osgeo.org
git at osgeo.org
Tue Jul 8 09:31:24 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 29d4f5d030293a9b8254022266e0789a2badc726 (commit)
from cee8cc2aae43a84f0d1d146604f7bd42066d379b (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 29d4f5d030293a9b8254022266e0789a2badc726
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jul 8 09:31:05 2025 -0700
DiscreteFrechet Crash on Point arguments (#1280)
Do not drop point geometries in densification step!
diff --git a/src/algorithm/distance/DiscreteFrechetDistance.cpp b/src/algorithm/distance/DiscreteFrechetDistance.cpp
index 4fa6d0f50..29f4a364f 100644
--- a/src/algorithm/distance/DiscreteFrechetDistance.cpp
+++ b/src/algorithm/distance/DiscreteFrechetDistance.cpp
@@ -343,8 +343,12 @@ DiscreteFrechetDistance::DensifiedCoordinatesFilter::filter_ro(
{
// Skip the first coordinate so we can operate an edge
// at a time
- if (index == 0)
+ if (index == 0) {
+ // Preserve one coordinate for points
+ if (seq.size() == 1)
+ m_coords.add(seq.getAt(index), true);
return;
+ }
const geom::Coordinate& p0 = seq.getAt(index - 1);
const geom::Coordinate& p1 = seq.getAt(index);
diff --git a/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp b/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
index d118b494f..86472ac06 100644
--- a/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
+++ b/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
@@ -153,7 +153,7 @@ void object::test<6> ()
}
}
-// Large test data set caused stack overflow in old
+// Large test data set caused stack overflow in old
// recursive version of the algorithm
// https://github.com/libgeos/geos/issues/516
@@ -173,5 +173,11 @@ void object::test<8> ()
checkDensifiedFrechet("LINESTRING(1 0, 2 0)", "LINESTRING(-1 0, 0 0, 7 8)", 0.002, 9.43398);
}
+template<>
+template<>
+void object::test<9> ()
+{
+ checkDensifiedFrechet("POINT(-11.1111111 40)", "POINT(-11.1111111 40)", 0.8, 0);
+}
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
src/algorithm/distance/DiscreteFrechetDistance.cpp | 6 +++++-
tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp | 8 +++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list