From git at osgeo.org Thu Mar 5 05:59:45 2026 From: git at osgeo.org (git at osgeo.org) Date: Thu, 5 Mar 2026 05:59:45 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 99494637e83a22284fadb24e527c3eedb1250e1b Message-ID: <20260305135946.1579818DDB0@trac.osgeo.org> 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 99494637e83a22284fadb24e527c3eedb1250e1b (commit) from a180ae12ad185da32746e665ee068b63b1ac4644 (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 99494637e83a22284fadb24e527c3eedb1250e1b Author: MUGUNDAN Date: Thu Mar 5 08:59:22 2026 -0500 Add support for building and testing Geos on Windows ARM64 (#1385) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 108465511..37b039887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,7 +324,15 @@ jobs: windows-msvc-msbuild: name: Windows (MSVC MSBuild) - runs-on: windows-2022 + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: windows-2022 + arch: x64 + - os: windows-11-arm + arch: arm64 + steps: - name: 'Check Out' uses: actions/checkout at v4 @@ -339,6 +347,7 @@ jobs: cmake --version cmake ^ -G "Visual Studio 17 2022" ^ + -A ${{ matrix.arch }} ^ -D CMAKE_BUILD_TYPE=Debug ^ -D CMAKE_CXX_STANDARD=17 ^ -D BUILD_SHARED_LIBS=ON ^ @@ -362,6 +371,9 @@ jobs: - os: windows-2025 cxxstd: 20 arch: x64 + - os: windows-11-arm + cxxstd: 20 + arch: arm64 runs-on: ${{ matrix.ci.os }} steps: @@ -619,3 +631,4 @@ jobs: cmake --build build -j $(nproc) build/capi_read test ! -f build/geos/bin/test_geos_unit || { echo "Error: GEOS tests were built" 1>&2 ; exit 1; } + ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 05:50:47 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 05:50:47 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 0f150b39c332b89db633e88c83a7e27dc3b13c1b Message-ID: <20260307135048.9F3E618CEDB@trac.osgeo.org> 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 0f150b39c332b89db633e88c83a7e27dc3b13c1b (commit) from 99494637e83a22284fadb24e527c3eedb1250e1b (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 0f150b39c332b89db633e88c83a7e27dc3b13c1b Author: Daniel Baston Date: Sat Mar 7 08:50:24 2026 -0500 C API: Add some comments/tests on Z/M handling (#1389) diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index b31a4290a..8c85598e4 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3290,7 +3290,8 @@ extern char GEOS_DLL GEOSisEmpty(const GEOSGeometry* g); /** * Tests whether the input geometry is a ring. Rings are * linestrings, without self-intersections, -* with start and end point being identical. +* with start and end point having the same XY values. +* Z and M values are not considered. * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception * \since 2.2 @@ -3317,7 +3318,8 @@ extern char GEOS_DLL GEOSHasM(const GEOSGeometry* g); /** * Tests whether the input geometry is closed. * A closed geometry is a linestring or multilinestring -* with the start and end points being the same. +* with the start and end points having the same XY values. +* Z and M values are not considered. * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception * \since 3.3 @@ -3363,6 +3365,8 @@ extern void GEOS_DLL GEOSGeom_setUserData(GEOSGeometry* g, void* userData); * - Polygon shell rings are oriented CW, and holes CCW * - Collection elements are sorted by their first coordinate * +* Coordinate Z and M values are not modified during normalization. +* * Use before calling \ref GEOSEqualsExact to avoid false "not equal" results. * \param g Input geometry * \return 0 on success or -1 on exception @@ -3373,6 +3377,7 @@ extern int GEOS_DLL GEOSNormalize(GEOSGeometry* g); /** * Enforce a ring orientation on all polygonal elements in the input geometry. * Non-polygonal geometries will not be modified. +* Coordinate Z and M values are not modified. * * \param g Input geometry * \param exteriorCW if 1, exterior rings will be clockwise and interior rings @@ -3395,6 +3400,7 @@ and geometric quality. /** * Tests whether the input geometry is "simple". Mostly relevant for * linestrings. A "simple" linestring has no self-intersections. +* Z and M values are not considered. * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception * \since 2.2 @@ -3428,6 +3434,8 @@ extern char GEOS_DLL GEOSisSimpleDetail( * contained within exterior rings. * - Multi-polygon components may not touch or overlap. * +* Z and M values are not considered. +* * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception * \see geos::operation::valid::isValidOp @@ -3560,7 +3568,7 @@ extern int GEOS_DLL GEOSMakeValidParams_setKeepCollapsed( extern int GEOS_DLL GEOSMinimumClearance(const GEOSGeometry* g, double* d); /** -* Returns a LineString whose endpoints define the minimum clearance of a geometry. +* Returns a 2D LineString whose endpoints define the minimum clearance of a geometry. * If the geometry has no minimum clearance, an empty LineString will be returned. * * \param g the input geometry @@ -3581,6 +3589,9 @@ extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine(const GEOSGeometry* g); * result in an invalid geometry being returned. Be sure * to check and repair validity. * +* Z and M coordinate values are preserved but are not considered when +* determining if a point is repeated. +* * \return A geometry with all points within the tolerance of each other removed. * \param g The geometry to filter * \param tolerance Remove all points within this distance of each other. Use 0.0 to remove only exactly repeated points. @@ -3614,6 +3625,7 @@ extern int GEOS_DLL GEOSArea( /** * Calculate the length of a geometry. +* Length is calculated in the XY plane; Z and M values are ignored. * \param[in] g Input geometry * \param[out] length Pointer to be filled in with length result * \return 1 on success, 0 on exception. @@ -3626,6 +3638,7 @@ extern int GEOS_DLL GEOSLength( /** * Calculate the length of a LineString. * Only works for LineString inputs, returns exception otherwise. +* Length is calculated in the XY plane; Z and M values are ignored. * * \param[in] g Input geometry * \param[out] length Pointer to be filled in with length result @@ -3647,6 +3660,8 @@ extern int GEOS_DLL GEOSGeomGetLength( /** * Calculate the distance between two geometries. +* Distance is calculated in the XY plane; Z and M values are ignored. +* * \param[in] g1 Input geometry * \param[in] g2 Input geometry * \param[out] dist Pointer to be filled in with distance result. Positive @@ -3662,6 +3677,8 @@ extern int GEOS_DLL GEOSDistance( /** * Test whether the distance between two geometries is * within the given dist. +* Distance is calculated in the XY plane; Z and M values are ignored. +* * \param g1 Input geometry * \param g2 Input geometry * \param dist The max distance @@ -3695,6 +3712,7 @@ extern int GEOS_DLL GEOSDistanceIndexed( /** * The closest points of the two geometries. * The first point comes from g1 geometry and the second point comes from g2. +* Returned points will not have Z or M values. * * \param[in] g1 Input geometry * \param[in] g2 Input geometry @@ -4301,6 +4319,8 @@ extern void GEOS_DLL GEOSClusterInfo_destroy(GEOSClusterInfo* clusters); /** * Buffer a geometry. +* The coordinates of the constructed geometry will not have Z or M values. +* * \param g The input geometry to be buffered. * \param width The distance by which to expand the geometry (or contract) * if the value is negative. @@ -4413,6 +4433,8 @@ extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams( /** * Generate a buffer using the provided style parameters. +* The coordinates of the constructed geometry will not have Z or M values. +* * \param g The geometry to buffer * \param width Width of the buffer * \param quadsegs Number of segments per quadrant @@ -4434,7 +4456,8 @@ extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle( /** * Generates offset curve line(s) for a geometry. -* Handles all geometry types as input. +* Handles all non-curved geometry types as input. +* The coordinates of the constructed geometry will not have Z or M values. * * - For a LineString the result is a LineString. * - For a Point the result is an empty LineString. diff --git a/tests/unit/capi/GEOSBufferTest.cpp b/tests/unit/capi/GEOSBufferTest.cpp index 702cc8dff..f8a555bf3 100644 --- a/tests/unit/capi/GEOSBufferTest.cpp +++ b/tests/unit/capi/GEOSBufferTest.cpp @@ -472,4 +472,19 @@ void object::test<26>() ensure(result_ == nullptr); } +template<> +template<> +void object::test<27>() +{ + set_test_name("buffer of XYZM geometry is XY"); + + input_ = fromWKT("POINT ZM (1 2 3 4)"); + ensure(input_ != nullptr); + + result_ = GEOSBuffer(input_, 1, 8); + ensure(result_ != nullptr); + ensure(!GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSDistanceTest.cpp b/tests/unit/capi/GEOSDistanceTest.cpp index 152aade8b..42a895a62 100644 --- a/tests/unit/capi/GEOSDistanceTest.cpp +++ b/tests/unit/capi/GEOSDistanceTest.cpp @@ -182,5 +182,22 @@ void object::test<6>() ensure_equals("curved geometry not supported", ret, 0); } +template<> +template<> +void object::test<7>() +{ + set_test_name("distance calculated in 2D only"); + + geom1_ = fromWKT("POINT ZM (0 0 1 2)"); + geom2_ = fromWKT("POINT ZM (3 4 7 9)"); + + ensure(geom1_); + ensure(geom2_); + + double dist; + ensure_equals(GEOSDistance(geom1_, geom2_, &dist), 1); + ensure_equals(dist, 5.0); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSDistanceWithinTest.cpp b/tests/unit/capi/GEOSDistanceWithinTest.cpp index e64c14b63..074c1b59b 100644 --- a/tests/unit/capi/GEOSDistanceWithinTest.cpp +++ b/tests/unit/capi/GEOSDistanceWithinTest.cpp @@ -422,6 +422,20 @@ void object::test<32>() ensure_equals("curved geometry not supported", ret, 2); } +template<> +template<> +void object::test<33>() +{ + set_test_name("distance calculated in 2D only"); + + geom1_ = fromWKT("POINT ZM (0 0 1 2)"); + geom2_ = fromWKT("POINT ZM (3 4 7 9)"); + + ensure(geom1_); + ensure(geom2_); + + ensure_equals(GEOSDistanceWithin(geom1_, geom2_, 5.0000001), 1); +} } // namespace tut diff --git a/tests/unit/capi/GEOSLengthTest.cpp b/tests/unit/capi/GEOSLengthTest.cpp index 7be71de71..5e89a0ede 100644 --- a/tests/unit/capi/GEOSLengthTest.cpp +++ b/tests/unit/capi/GEOSLengthTest.cpp @@ -72,5 +72,21 @@ void object::test<4>() ensure_equals(length, geos::MATH_PI); } +template<> +template<> +void object::test<5>() +{ + set_test_name("length calculated in 2D only"); + + input_ = fromWKT("LINESTRING (0 0 0 0, 1 0 7 9)"); + ensure(input_ != nullptr); + + double length = -1; + int ret = GEOSLength(input_, &length); + ensure_equals(ret, 1); + ensure_equals(length, 1); +} + + } // namespace tut diff --git a/tests/unit/capi/GEOSLineStringTest.cpp b/tests/unit/capi/GEOSLineStringTest.cpp index ca795de60..4beae5439 100644 --- a/tests/unit/capi/GEOSLineStringTest.cpp +++ b/tests/unit/capi/GEOSLineStringTest.cpp @@ -168,4 +168,20 @@ void object::test<5> ensure(length > 0.0); } +template<> +template<> +void object::test<6> +() +{ + set_test_name("length calculated in 2D only"); + + input_ = fromWKT("LINESTRING (0 0 0 0, 1 0 7 9)"); + ensure(input_ != nullptr); + + double length = -1; + int ret = GEOSGeomGetLength(input_, &length); + ensure_equals(ret, 1); + ensure_equals(length, 1); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSMakeValidTest.cpp b/tests/unit/capi/GEOSMakeValidTest.cpp index c6531d5b8..0cad2e552 100644 --- a/tests/unit/capi/GEOSMakeValidTest.cpp +++ b/tests/unit/capi/GEOSMakeValidTest.cpp @@ -102,4 +102,31 @@ void object::test<5>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<6>() +{ + set_test_name("Z/M values preserved for valid input"); + + input_ = fromWKT("POLYGON ZM ((0 0 1 2, 1 0 2 3, 1 1 3 4, 0 0 1 2))"); + ensure(input_); + + result_ = GEOSMakeValid(input_); + ensure_geometry_equals_identical(result_, input_); +} + +template<> +template<> +void object::test<7>() +{ + set_test_name("Z/M values are preserved/interpolated for self-intersecting input"); + + input_ = fromWKT("POLYGON ZM ((0 0 1 2, 1 0 2 3, 0 1 3 4, 1 1 4 5, 0 0 1 2))"); + ensure(input_); + + result_ = GEOSMakeValid(input_); + expected_ = fromWKT("MULTIPOLYGON ZM (((0 0 1 2, 0.5 0.5 2.5 3.5, 1 0 2 3, 0 0 1 2)), ((1 1 4 5, 0.5 0.5 2.5 3.5, 0 1 3 4, 1 1 4 5)))"); + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSMinimumClearanceTest.cpp b/tests/unit/capi/GEOSMinimumClearanceTest.cpp index 064763986..49fca2637 100644 --- a/tests/unit/capi/GEOSMinimumClearanceTest.cpp +++ b/tests/unit/capi/GEOSMinimumClearanceTest.cpp @@ -126,4 +126,21 @@ void object::test<6> ensure_equals(GEOSMinimumClearance(input_, &d), 2); } +template<> +template<> +void object::test<7>() +{ + set_test_name("2D LineString returned for 4D inputs"); + + input_ = fromWKT("POLYGON ZM ((0 0 1 2, 2 0 2 3, 2 1 3 4, 1 0.1 4 5, 0 1 5 6, 0 0 1 2))"); + result_ = GEOSMinimumClearanceLine(input_); + + ensure(result_ != nullptr); + ensure(!GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); + + expected_ = fromWKT("LINESTRING (1 0.1, 1 0)"); + ensure_geometry_equals(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSNearestPointsTest.cpp b/tests/unit/capi/GEOSNearestPointsTest.cpp index c1caa1887..fb7581751 100644 --- a/tests/unit/capi/GEOSNearestPointsTest.cpp +++ b/tests/unit/capi/GEOSNearestPointsTest.cpp @@ -139,5 +139,25 @@ void object::test<6> ); } +template<> +template<> +void object::test<7>() +{ + set_test_name("2D points returned for 4D inputs"); + + geom1_ = fromWKT("POINT ZM (0 0 1 2)"); + geom2_ = fromWKT("POINT ZM (3 4 7 9)"); + + ensure(geom1_); + ensure(geom2_); + + GEOSCoordSequence* coords = GEOSNearestPoints(geom1_, geom2_); + ensure(coords); + ensure(!GEOSCoordSeq_hasM(coords)); + ensure(!GEOSCoordSeq_hasZ(coords)); + + GEOSCoordSeq_destroy(coords); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSOffsetCurveTest.cpp b/tests/unit/capi/GEOSOffsetCurveTest.cpp index a979155b8..242d18853 100644 --- a/tests/unit/capi/GEOSOffsetCurveTest.cpp +++ b/tests/unit/capi/GEOSOffsetCurveTest.cpp @@ -270,5 +270,24 @@ void object::test<13>() ensure("curved geometries not supported", result_ == nullptr); } +template<> +template<> +void object::test<14>() +{ + set_test_name("offset of XYZM geometry is XY"); + + input_ = fromWKT("LINESTRING ZM (0 0 3 5, 10 0 7 8)"); + ensure(input_); + + result_ = GEOSOffsetCurve(input_, 2, 0, GEOSBUF_JOIN_ROUND, 2); + + ensure(result_); + ensure(!GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); + + expected_ = fromWKT("LINESTRING (0 2, 10 2)"); + ensure_geometry_equals(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSOrientPolygonsTest.cpp b/tests/unit/capi/GEOSOrientPolygonsTest.cpp index a82955911..10cbcdbe8 100644 --- a/tests/unit/capi/GEOSOrientPolygonsTest.cpp +++ b/tests/unit/capi/GEOSOrientPolygonsTest.cpp @@ -95,5 +95,20 @@ void object::test<6>() ensure_equals("curved geometries not supported", ret, -1); } +template<> +template<> +void object::test<7>() +{ + set_test_name("Z/M values preserved"); + + geom1_ = GEOSGeomFromWKT("POLYGON ZM ((0 0 5 7, 10 0 6 8, 10 10 7 9, 0 10 8 10, 0 0 5 7), (1 1 1 3, 2 1 2 4, 2 2 3 5, 1 2 4 6, 1 1 1 3))"); + + ensure_equals(GEOSOrientPolygons(geom1_, 0), 0); + ensure_equals(toWKT(geom1_), "POLYGON ZM ((0 0 5 7, 10 0 6 8, 10 10 7 9, 0 10 8 10, 0 0 5 7), (1 1 1 3, 1 2 4 6, 2 2 3 5, 2 1 2 4, 1 1 1 3))"); + + ensure_equals(GEOSOrientPolygons(geom1_, 1), 0); + ensure_equals(toWKT(geom1_), "POLYGON ZM ((0 0 5 7, 0 10 8 10, 10 10 7 9, 10 0 6 8, 0 0 5 7), (1 1 1 3, 2 1 2 4, 2 2 3 5, 1 2 4 6, 1 1 1 3))"); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSRemoveRepeatedPointsTest.cpp b/tests/unit/capi/GEOSRemoveRepeatedPointsTest.cpp index c1a53bb32..2ce17f6a1 100644 --- a/tests/unit/capi/GEOSRemoveRepeatedPointsTest.cpp +++ b/tests/unit/capi/GEOSRemoveRepeatedPointsTest.cpp @@ -60,4 +60,19 @@ void object::test<3>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<4>() +{ + set_test_name("Z/M values not considered"); + + input_ = fromWKT("LINESTRING ZM (0 0 0 0, 1 3 5 6, 1 3 6 7, 2 6 7 4)"); + ensure(input_); + + expected_ = fromWKT("LINESTRING ZM (0 0 0 0, 1 3 5 6, 2 6 7 4)"); + + result_ = GEOSRemoveRepeatedPoints(input_, 0); + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 31 +++++++++++++++++++++--- tests/unit/capi/GEOSBufferTest.cpp | 15 ++++++++++++ tests/unit/capi/GEOSDistanceTest.cpp | 17 +++++++++++++ tests/unit/capi/GEOSDistanceWithinTest.cpp | 14 +++++++++++ tests/unit/capi/GEOSLengthTest.cpp | 16 ++++++++++++ tests/unit/capi/GEOSLineStringTest.cpp | 16 ++++++++++++ tests/unit/capi/GEOSMakeValidTest.cpp | 27 +++++++++++++++++++++ tests/unit/capi/GEOSMinimumClearanceTest.cpp | 17 +++++++++++++ tests/unit/capi/GEOSNearestPointsTest.cpp | 20 +++++++++++++++ tests/unit/capi/GEOSOffsetCurveTest.cpp | 19 +++++++++++++++ tests/unit/capi/GEOSOrientPolygonsTest.cpp | 15 ++++++++++++ tests/unit/capi/GEOSRemoveRepeatedPointsTest.cpp | 15 ++++++++++++ 12 files changed, 218 insertions(+), 4 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 10:32:23 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 10:32:23 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 9f2be966553f6b81b69b1d2ec7aaf2b6bc3b79ac Message-ID: <20260307183223.A3E921A0BE9@trac.osgeo.org> 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 9f2be966553f6b81b69b1d2ec7aaf2b6bc3b79ac (commit) from 0f150b39c332b89db633e88c83a7e27dc3b13c1b (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 9f2be966553f6b81b69b1d2ec7aaf2b6bc3b79ac Author: Daniel Baston Date: Sat Mar 7 13:31:57 2026 -0500 GEOSInterpolate: Interpolate M value (#1390) diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 8c85598e4..800d3f473 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3874,10 +3874,13 @@ extern double GEOS_DLL GEOSProject(const GEOSGeometry* line, const GEOSGeometry* point); /** -* Measuring from start of line, return point that is distance -* the start. Line parameter must be a LineString. -* The returned point is not guaranteed to intersect the line due to limitations -* of floating point calculations. +* Return the point that is the specified 2D distance along a LineString from the start. +* +* If applicable, the Z value of the returned point will be interpolated from the input line. +* Since GEOS 3.15, the M value will also be interpolated. +* +* If the input is not a LineString, NULL will be returned. +* * \param line linear target of projection * \param d distance from start of line to created point * \return The point \ref GEOSGeometry that is distance from the start of line. @@ -3901,8 +3904,14 @@ extern double GEOS_DLL GEOSProjectNormalized(const GEOSGeometry* line, const GEOSGeometry* point); /** -* Measuring from start of line, return point that is a proportion -* the start. Line parameter must be a LineString. +* Measuring from start of a LineString, return the point at the specified +* fraction of the total length. +* +* If applicable, the Z value of the returned point will be interpolated from the input line. +* Since GEOS 3.15, the M value will also be interpolated. +* +* If the input is not a LineString, NULL will be returned. +* * \param line linear target of projection * \param proportion The proportion from the start of line to created point * \return The point \ref GEOSGeometry that is distance from the start of line. diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index e082f799c..78a96a612 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -4291,11 +4291,21 @@ extern "C" { { return execute(extHandle, [&]() { GEOSContextHandleInternal_t* handle = reinterpret_cast(extHandle); + const GeometryFactory* gf = handle->geomFactory; geos::linearref::LengthIndexedLine lil(g); - geos::geom::Coordinate coord = lil.extractPoint(d); - const GeometryFactory* gf = handle->geomFactory; - auto point = coord.isNull() ? gf->createPoint(g->getCoordinateDimension()) : gf->createPoint(coord); + CoordinateXYZM coord = lil.extractPoint(d); + + std::unique_ptr point; + + if (coord.isNull()) { + point = gf->createPoint(g->hasZ(), g->hasM()); + } else { + auto seq = std::make_unique(1, g->hasZ(), g->hasM()); + seq->setAt(coord, 0); + point = gf->createPoint(std::move(seq)); + } + point->setSRID(g->getSRID()); return point.release(); }); diff --git a/include/geos/linearref/LengthIndexedLine.h b/include/geos/linearref/LengthIndexedLine.h index 42af91e58..7f5c51075 100644 --- a/include/geos/linearref/LengthIndexedLine.h +++ b/include/geos/linearref/LengthIndexedLine.h @@ -64,14 +64,13 @@ public: * * If the index is out of range the first or last point on the * line will be returned. - * The Z-ordinate of the computed point will be interpolated from - * the Z-ordinates of the line segment containing it, if they exist. + * The Z and M ordinates of the computed point will be interpolated from + * the Z and M ordinates of the line segment containing it, if they exist. * * @param index the index of the desired point * @return the Coordinate at the given index */ - geom::Coordinate extractPoint(double index) const; - + geom::CoordinateXYZM extractPoint(double index) const; /** * \brief diff --git a/include/geos/linearref/LinearLocation.h b/include/geos/linearref/LinearLocation.h index bbce2b020..623204587 100644 --- a/include/geos/linearref/LinearLocation.h +++ b/include/geos/linearref/LinearLocation.h @@ -84,6 +84,8 @@ public: */ static geom::Coordinate pointAlongSegmentByFraction(const geom::Coordinate& p0, const geom::Coordinate& p1, double frac); + static geom::CoordinateXYZM pointAlongSegmentByFraction(const geom::CoordinateXYZM& p0, const geom::CoordinateXYZM& p1, + double frac); /** \brief @@ -161,7 +163,7 @@ public: * @param linearGeom the linear geometry referenced by this location * @return the Coordinate at the location */ - geom::Coordinate getCoordinate(const geom::Geometry* linearGeom) const; + geom::CoordinateXYZM getCoordinate(const geom::Geometry* linearGeom) const; /** \brief * Gets a [LineSegment](@ref geom::LineSegment) representing the segment of the diff --git a/src/linearref/LengthIndexedLine.cpp b/src/linearref/LengthIndexedLine.cpp index 5522eb32c..d25c02168 100644 --- a/src/linearref/LengthIndexedLine.cpp +++ b/src/linearref/LengthIndexedLine.cpp @@ -36,11 +36,11 @@ namespace linearref { // geos.linearref LengthIndexedLine::LengthIndexedLine(const Geometry* p_linearGeom) : linearGeom(p_linearGeom) {} -Coordinate +CoordinateXYZM LengthIndexedLine::extractPoint(double index) const { LinearLocation loc = LengthLocationMap::getLocation(linearGeom, index); - Coordinate coord = loc.getCoordinate(linearGeom); + CoordinateXYZM coord = loc.getCoordinate(linearGeom); return coord; } diff --git a/src/linearref/LinearLocation.cpp b/src/linearref/LinearLocation.cpp index 5eabfab9c..09bbb1c32 100644 --- a/src/linearref/LinearLocation.cpp +++ b/src/linearref/LinearLocation.cpp @@ -59,6 +59,25 @@ LinearLocation::pointAlongSegmentByFraction(const Coordinate& p0, const Coordina return Coordinate(x, y, z); } +CoordinateXYZM +LinearLocation::pointAlongSegmentByFraction(const CoordinateXYZM& p0, const CoordinateXYZM& p1, double frac) +{ + if(frac <= 0.0) { + return p0; + } + if(frac >= 1.0) { + return p1; + } + + double x = (p1.x - p0.x) * frac + p0.x; + double y = (p1.y - p0.y) * frac + p0.y; + // interpolate Z/M values. If either is NaN, result will be NaN as well. + double z = (p1.z - p0.z) * frac + p0.z; + double m = (p1.m - p0.m) * frac + p0.m; + + return CoordinateXYZM(x, y, z, m); +} + /* public */ LinearLocation::LinearLocation(std::size_t p_segmentIndex, double p_segmentFraction) @@ -201,21 +220,27 @@ LinearLocation::isVertex() const } /* public */ -Coordinate +CoordinateXYZM LinearLocation::getCoordinate(const Geometry* linearGeom) const { if(linearGeom->isEmpty()) { - return Coordinate::getNull(); + return CoordinateXYZM::getNull(); } const LineString* lineComp = dynamic_cast(linearGeom->getGeometryN(componentIndex)); if(! lineComp) { throw util::IllegalArgumentException("LinearLocation::getCoordinate only works with LineString geometries"); } - Coordinate p0 = lineComp->getCoordinateN(segmentIndex); - if(segmentIndex >= lineComp->getNumPoints() - 1) { + + const CoordinateSequence* pts = lineComp->getCoordinatesRO(); + CoordinateXYZM p0; + pts->getAt(segmentIndex, p0); + if (segmentIndex >= pts->size() - 1) { return p0; } - Coordinate p1 = lineComp->getCoordinateN(segmentIndex + 1); + + CoordinateXYZM p1; + pts->getAt(segmentIndex + 1, p1); + return pointAlongSegmentByFraction(p0, p1, segmentFraction); } diff --git a/tests/unit/capi/GEOSInterpolateTest.cpp b/tests/unit/capi/GEOSInterpolateTest.cpp index 44992617f..5cfeec787 100644 --- a/tests/unit/capi/GEOSInterpolateTest.cpp +++ b/tests/unit/capi/GEOSInterpolateTest.cpp @@ -3,11 +3,6 @@ #include // geos #include -// std -#include -#include -#include -#include #include "capi_test_utils.h" @@ -57,7 +52,7 @@ void object::test<3> result_ = GEOSInterpolate(geom1_, 0.5); expected_ = GEOSGeomFromWKT("POINT (0.5 0)"); - ensure_geometry_equals(result_, expected_); + ensure_geometry_equals_identical(result_, expected_); } template<> @@ -69,7 +64,7 @@ void object::test<4> result_ = GEOSInterpolateNormalized(geom1_, 0.5); expected_ = GEOSGeomFromWKT("POINT (5 0)"); - ensure_geometry_equals(result_, expected_); + ensure_geometry_equals_identical(result_, expected_); } // ensure NaN argument does not crash @@ -82,4 +77,75 @@ void object::test<5> result_ = GEOSInterpolate(geom1_, std::numeric_limits::quiet_NaN()); } +template<> +template<> +void object::test<6> +() +{ + set_test_name("Z/M interpolated"); + + geom1_ = fromWKT("LINESTRING ZM (0 0 6 8, 10 0 12 16)"); + result_ = GEOSInterpolate(geom1_, 5); + expected_ = fromWKT("POINT ZM (5 0 9 12)"); + + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<7> +() +{ + set_test_name("Empty LINESTRING M"); + + geom1_ = fromWKT("LINESTRING M EMPTY"); + result_ = GEOSInterpolate(geom1_, 5); + expected_ = fromWKT("POINT M EMPTY"); + + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<8> +() +{ + set_test_name("Empty LINESTRING Z"); + + geom1_ = fromWKT("LINESTRING Z EMPTY"); + result_ = GEOSInterpolate(geom1_, 5); + expected_ = fromWKT("POINT Z EMPTY"); + + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<9> +() +{ + set_test_name("Empty LINESTRING ZM"); + + geom1_ = fromWKT("LINESTRING ZM EMPTY"); + result_ = GEOSInterpolate(geom1_, 5); + expected_ = fromWKT("POINT ZM EMPTY"); + + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<10> +() +{ + set_test_name("Non-LineString input"); + + input_ = fromWKT("POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))"); + ensure(input_); + + result_ = GEOSInterpolate(input_, 5); + + ensure(result_ == nullptr); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 21 +++++--- capi/geos_ts_c.cpp | 16 ++++-- include/geos/linearref/LengthIndexedLine.h | 7 ++- include/geos/linearref/LinearLocation.h | 4 +- src/linearref/LengthIndexedLine.cpp | 4 +- src/linearref/LinearLocation.cpp | 35 +++++++++++-- tests/unit/capi/GEOSInterpolateTest.cpp | 80 +++++++++++++++++++++++++++--- 7 files changed, 139 insertions(+), 28 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 17:09:54 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 17:09:54 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. b896045021458077ae4c10e831b5d2461f54d3cc Message-ID: <20260308010954.E87D91A1DA9@trac.osgeo.org> 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 b896045021458077ae4c10e831b5d2461f54d3cc (commit) via e49be080abdc2ad8a9ce3abcede99a272207f22d (commit) via 407e7f47888f91d386d3a42c18014bd524e13a94 (commit) from 9f2be966553f6b81b69b1d2ec7aaf2b6bc3b79ac (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 b896045021458077ae4c10e831b5d2461f54d3cc Author: Daniel Baston Date: Sat Mar 7 20:09:09 2026 -0500 CircularString::getArcs: avoid underflow on empty CircularString diff --git a/src/geom/CircularString.cpp b/src/geom/CircularString.cpp index ac5311905..ebfdd765b 100644 --- a/src/geom/CircularString.cpp +++ b/src/geom/CircularString.cpp @@ -49,6 +49,10 @@ CircularString::clone() const void CircularString::createArcs() const { + if (points->getSize() < 3) { + return; + } + for (std::size_t i = 0; i < points->getSize() - 2; i += 2) { arcs.emplace_back(*points, i); } diff --git a/tests/unit/geom/CircularStringTest.cpp b/tests/unit/geom/CircularStringTest.cpp index a4a9a9d14..045c61739 100644 --- a/tests/unit/geom/CircularStringTest.cpp +++ b/tests/unit/geom/CircularStringTest.cpp @@ -199,4 +199,16 @@ void object::test<5>() ensure_THROW(factory_->createCircularString(pts), geos::util::GEOSException); } +template<> +template<> +void object::test<6>() +{ + set_test_name("getArcs on empty CircularString"); + + auto geom = factory_->createEmpty(geos::geom::GEOS_CIRCULARSTRING); + + const auto& arcs = static_cast(geom.get())->getArcs(); + ensure(arcs.empty()); +} + } commit e49be080abdc2ad8a9ce3abcede99a272207f22d Author: Daniel Baston Date: Tue Dec 23 10:50:00 2025 -0500 CoordinateSequence: Add comments diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h index 249e9ddd7..c284b9bc2 100644 --- a/include/geos/geom/CoordinateSequence.h +++ b/include/geos/geom/CoordinateSequence.h @@ -579,8 +579,10 @@ public: void add(const CoordinateSequence& cl, bool allowRepeated, bool forwardDirection); + /// Add the portion of a CoordinateSequence between the specified indices (inclusive) void add(const CoordinateSequence& cs, std::size_t from, std::size_t to); + /// Add the portion of a CoordinateSequence between the specified indices (inclusive) void add(const CoordinateSequence& cs, std::size_t from, std::size_t to, bool allowRepeated); template commit 407e7f47888f91d386d3a42c18014bd524e13a94 Author: Daniel Baston Date: Mon Dec 22 14:34:29 2025 -0500 Add test for CurvePolygon area diff --git a/tests/unit/geom/CurvePolygonTest.cpp b/tests/unit/geom/CurvePolygonTest.cpp index 0ee7d4baa..774a8bb32 100644 --- a/tests/unit/geom/CurvePolygonTest.cpp +++ b/tests/unit/geom/CurvePolygonTest.cpp @@ -9,6 +9,7 @@ #include using geos::geom::CoordinateXY; +using geos::geom::CurvePolygon; namespace tut { @@ -183,4 +184,18 @@ void object::test<3>() ensure_THROW(cc3->normalize(), geos::util::UnsupportedOperationException); } +template<> +template<> +void object::test<4>() +{ + set_test_name("getArea"); + + // SELECT ST_Area(ST_CurveToLine('CURVEPOLYGON (CIRCULARSTRING(0 0,0 2,1 2,1 1,2 1,3 0,0 0))', 36000)); + auto cp = wktreader_.read("CURVEPOLYGON (CIRCULARSTRING(0 0,0 2,1 2,1 1,2 1,3 0,0 0))"); + ensure_equals("cp->getArea()", cp->getArea(), 9.8185835, 1e-6); + + auto cpRev = cp->reverse(); + ensure_equals("cpRev->getArea()", cpRev->getArea(), 9.8185835, 1e-6); +} + } ----------------------------------------------------------------------- Summary of changes: include/geos/geom/CoordinateSequence.h | 2 ++ src/geom/CircularString.cpp | 4 ++++ tests/unit/geom/CircularStringTest.cpp | 12 ++++++++++++ tests/unit/geom/CurvePolygonTest.cpp | 15 +++++++++++++++ 4 files changed, 33 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 17:10:45 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 17:10:45 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 1ea477e8cae3e7da22ce645cf29665a9e21e8641 Message-ID: <20260308011045.B3A251A1DAA@trac.osgeo.org> 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 1ea477e8cae3e7da22ce645cf29665a9e21e8641 (commit) from b896045021458077ae4c10e831b5d2461f54d3cc (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 1ea477e8cae3e7da22ce645cf29665a9e21e8641 Author: Daniel Baston Date: Sat Mar 7 20:10:21 2026 -0500 DBSCAN: Fix unassigned clusters with minPoints <= 1 (#1386) diff --git a/src/operation/cluster/DBSCANClusterFinder.cpp b/src/operation/cluster/DBSCANClusterFinder.cpp index 1a87eb887..15da6c012 100644 --- a/src/operation/cluster/DBSCANClusterFinder.cpp +++ b/src/operation/cluster/DBSCANClusterFinder.cpp @@ -44,8 +44,10 @@ Clusters DBSCANClusterFinder::process(const std::vector & index::strtree::TemplateSTRtree & tree, UnionFind & uf) { - std::vector in_a_cluster(components.size()); - std::vector is_in_core(components.size()); + const bool allInputsInCluster = m_minPoints <= 1; + + std::vector in_a_cluster(components.size(), allInputsInCluster); + std::vector is_in_core(components.size(), allInputsInCluster); std::vector hits; std::vector neighbors; @@ -59,7 +61,7 @@ Clusters DBSCANClusterFinder::process(const std::vector & }); if (hits.size() < m_minPoints) { - // We didn't find enough points do do anything even if they're all within eps. + // We didn't find enough points to do anything even if they're all within eps. continue; } diff --git a/tests/unit/capi/GEOSClusterTest.cpp b/tests/unit/capi/GEOSClusterTest.cpp index f96d91ce5..c8136720f 100644 --- a/tests/unit/capi/GEOSClusterTest.cpp +++ b/tests/unit/capi/GEOSClusterTest.cpp @@ -105,6 +105,8 @@ template<> template<> void object::test<2>() { + set_test_name("DBSCAN"); + input_ = fromWKT( "GEOMETRYCOLLECTION (" "POINT (0 0)," @@ -118,6 +120,24 @@ void object::test<2>() "POINT ( 3 0.1)" ")"); + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.01, 0); + ensure_equals("nine clusters with eps=0.01, minPoints = 0", GEOSClusterInfo_getNumClusters(clusters), 9u); + GEOSClusterInfo_destroy(clusters); + } + + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.01, 1); + ensure_equals("nine clusters with eps=0.01, minPoints = 1", GEOSClusterInfo_getNumClusters(clusters), 9u); + GEOSClusterInfo_destroy(clusters); + } + + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.1, 1); + ensure_equals("five clusters with eps=0.1, minPoints = 1", GEOSClusterInfo_getNumClusters(clusters), 5u); + GEOSClusterInfo_destroy(clusters); + } + { GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 1.01, 5); ensure_equals("two clusters with minPoints = 5", GEOSClusterInfo_getNumClusters(clusters), 2u); ----------------------------------------------------------------------- Summary of changes: src/operation/cluster/DBSCANClusterFinder.cpp | 8 +++++--- tests/unit/capi/GEOSClusterTest.cpp | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 18:02:16 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 18:02:16 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 483b30722a47761b87592f8f910b7e0a073b0f69 Message-ID: <20260308020216.535C01A2498@trac.osgeo.org> 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 483b30722a47761b87592f8f910b7e0a073b0f69 (commit) from 1ea477e8cae3e7da22ce645cf29665a9e21e8641 (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 483b30722a47761b87592f8f910b7e0a073b0f69 Author: Daniel Baston Date: Sat Mar 7 21:01:55 2026 -0500 SegmentNodeList: Preserve Z/M in mixed-dimension overlay (#1388) diff --git a/src/noding/SegmentNodeList.cpp b/src/noding/SegmentNodeList.cpp index 4404ddfb0..2415efe0c 100644 --- a/src/noding/SegmentNodeList.cpp +++ b/src/noding/SegmentNodeList.cpp @@ -280,6 +280,14 @@ SegmentNodeList::createSplitEdgePts(const SegmentNode *ei0, const SegmentNode *e pts->add(*edgeCoords, ei0->segmentIndex + 1, ei1->segmentIndex); if (useIntPt1) { pts->add(ei1->coord); + } else if (ei1->coord.equals2D(lastSegStartPt)) { + // Can we pick up Z/M values from ei1 that weren't present in edgeCoords? + if (constructZ && !edgeCoords->hasZ() && !std::isnan(ei1->coord.z)) { + pts->setZ(pts->size() - 1, ei1->coord.z); + } + if (constructM && !edgeCoords->hasM() && !std::isnan(ei1->coord.m)) { + pts->setM(pts->size() - 1, ei1->coord.m); + } } assert(pts->size() == npts); diff --git a/src/operation/overlayng/OverlayUtil.cpp b/src/operation/overlayng/OverlayUtil.cpp index 23b07f22e..aa7138a45 100644 --- a/src/operation/overlayng/OverlayUtil.cpp +++ b/src/operation/overlayng/OverlayUtil.cpp @@ -311,7 +311,7 @@ OverlayUtil::toLines(OverlayGraph* graph, bool isOutputEdges, const GeometryFact bool includeEdge = isOutputEdges || edge->isInResultArea(); if (! includeEdge) continue; - std::shared_ptr pts = edge->getCoordinatesOriented(); + const auto& pts = edge->getCoordinatesOriented(); std::unique_ptr line = geomFact->createLineString(pts); // line->setUserData(labelForResult(edge)); lines.push_back(std::move(line)); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index 721a8c46a..c5be746b5 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -331,7 +331,7 @@ void object::test<15>() result_ = GEOSNode(input_); ensure(result_ != nullptr); - expected_ = fromWKT("MULTILINESTRING Z ((-5 0 3, 4 3 6), (0 0 NaN, 4 3 NaN))"); + expected_ = fromWKT("MULTILINESTRING Z ((-5 0 3, 4 3 6), (0 0 NaN, 4 3 6))"); ensure_equals_exact_geometry_xyzm(reinterpret_cast(result_), reinterpret_cast(expected_), 1e-4); @@ -349,7 +349,7 @@ void object::test<16>() result_ = GEOSNode(input_); ensure(result_ != nullptr); - expected_ = fromWKT("MULTICURVE Z (CIRCULARSTRING Z (-5 0 3, -1.5811388301 4.7434164903 4.5, 4 3 6), (0 0 NaN, 4 3 NaN))"); + expected_ = fromWKT("MULTICURVE Z (CIRCULARSTRING Z (-5 0 3, -1.5811388301 4.7434164903 4.5, 4 3 6), (0 0 NaN, 4 3 6))"); ensure_equals_exact_geometry_xyzm(reinterpret_cast(result_), reinterpret_cast(expected_), 1e-4); diff --git a/tests/unit/capi/GEOSSharedPathsTest.cpp b/tests/unit/capi/GEOSSharedPathsTest.cpp index e1708d938..4316500ed 100644 --- a/tests/unit/capi/GEOSSharedPathsTest.cpp +++ b/tests/unit/capi/GEOSSharedPathsTest.cpp @@ -99,5 +99,40 @@ void object::test<4>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<5>() { + set_test_name("Z/M values taken from first input"); + + geom1_ = fromWKT("LINESTRING ZM (0 1 5 4, 0 0 6 5, 1 0 7 6, 1 1 8 7)"); + geom2_ = fromWKT("LINESTRING ZM (0 -1 3 8, 0 0 2 9, 1 0 1 10, 1 -1 0 11)"); + + ensure(geom1_); + ensure(geom2_); + + result_ = GEOSSharedPaths(geom1_, geom2_); + + expected_ = fromWKT("GEOMETRYCOLLECTION(MULTILINESTRING ZM ((0 0 6 5, 1 0 7 6)), MULTILINESTRING EMPTY)"); + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<6>() { + set_test_name("Z/M values taken from second input"); + + geom1_ = fromWKT("LINESTRING (0 1, 0 0, 1 0, 1 1)"); + geom2_ = fromWKT("LINESTRING ZM (0 -1 3 8, 0 0 2 9, 1 0 1 10, 1 -1 0 11)"); + + ensure(geom1_); + ensure(geom2_); + + result_ = GEOSSharedPaths(geom1_, geom2_); + + expected_ = fromWKT("GEOMETRYCOLLECTION(MULTILINESTRING ZM ((0 0 2 9, 1 0 1 10)), MULTILINESTRING EMPTY)"); + ensure_geometry_equals_identical(result_, expected_); +} + + } // namespace tut diff --git a/tests/unit/operation/overlayng/OverlayNGZTest.cpp b/tests/unit/operation/overlayng/OverlayNGZTest.cpp index 9769a7be0..e9ee46377 100644 --- a/tests/unit/operation/overlayng/OverlayNGZTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGZTest.cpp @@ -294,4 +294,26 @@ void object::test<19>() "POINT M (5 5 99)"); } +template<> +template<> +void object::test<20>() +{ + set_test_name("LINESTRING / LINESTRING ZM intersection"); + + checkIntersection("LINESTRING (0 0, 1 0)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)"); +} + +template<> +template<> +void object::test<21>() +{ + set_test_name("LINESTRING M / LINESTRING Z intersection"); + + checkIntersection("LINESTRING M (0 0 9, 1 0 7)", + "LINESTRING Z (1 0 5, 0 0 2)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)"); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/SegmentNodeList.cpp | 8 ++++++ src/operation/overlayng/OverlayUtil.cpp | 2 +- tests/unit/capi/GEOSNodeTest.cpp | 4 +-- tests/unit/capi/GEOSSharedPathsTest.cpp | 35 +++++++++++++++++++++++ tests/unit/operation/overlayng/OverlayNGZTest.cpp | 22 ++++++++++++++ 5 files changed, 68 insertions(+), 3 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sat Mar 7 19:18:12 2026 From: git at osgeo.org (git at osgeo.org) Date: Sat, 7 Mar 2026 19:18:12 -0800 (PST) Subject: [geos-commits] [SCM] GEOS branch main updated. 927e1df7e5f4202c64d986bb8ee858d53e5b71eb Message-ID: <20260308031813.1E8991A2348@trac.osgeo.org> 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 927e1df7e5f4202c64d986bb8ee858d53e5b71eb (commit) from 483b30722a47761b87592f8f910b7e0a073b0f69 (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 927e1df7e5f4202c64d986bb8ee858d53e5b71eb Author: Daniel Baston Date: Sat Mar 7 21:54:42 2026 -0500 C API: Add some comments/tests on Z/M handling diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 800d3f473..95a5e2600 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -4711,8 +4711,11 @@ GEOSCoverageClean( ///@{ /** -* Returns minimum rectangular polygon or point that contains the geometry, +* Returns minimum 2D rectangular polygon or point that contains the geometry, * or an empty point for empty inputs. +* +* Z and M values in the input coordinates are ignored. +* * \param g The geometry to calculate an envelope for * \return A newly allocated polygonal envelope or point. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -4728,6 +4731,8 @@ extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g); * - the boundary of a linestring is the end points * - the boundary of a point is the point * +* Z and M values in the input coordinates are preserved. +* * \param g The input geometry * \return A newly allocated geometry of the boundary. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -4736,8 +4741,12 @@ extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g); extern GEOSGeometry GEOS_DLL *GEOSBoundary(const GEOSGeometry* g); /** -* Returns convex hull of a geometry. The smallest convex Geometry +* Returns the convex hull of a geometry. The smallest convex Geometry * that contains all the points in the input Geometry +* +* Z values in the input coordinates will be preserved. +* M values in the input coordinates will not be preserved. +* * \param g The input geometry * \return A newly allocated geometry of the convex hull. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -4754,6 +4763,9 @@ extern GEOSGeometry GEOS_DLL *GEOSConvexHull(const GEOSGeometry* g); * Frequently used to convert a multi-point into a polygonal area. * that contains all the points in the input Geometry. * +* Z values in the input coordinates will be preserved. +* M values in the input coordinates will not be preserved. +* * A set of points has a sequence of hulls of increasing concaveness, * determined by a numeric target parameter. * The concave hull is constructed by removing the longest outer edges @@ -4789,6 +4801,9 @@ extern GEOSGeometry GEOS_DLL *GEOSConcaveHull( * Frequently used to convert a multi-point into a polygonal area. * that contains all the points in the input Geometry. * +* Z values in the input coordinates will be preserved. +* M values in the input coordinates will not be preserved. +* * A set of points has a sequence of hulls of increasing concaveness, * determined by a numeric target parameter. * The concave hull is constructed by removing the longest outer edges @@ -5368,6 +5383,8 @@ extern GEOSGeometry GEOS_DLL *GEOSSimplify( * that are co-linear within the tolerance distance. * Returns a valid output geometry, checking for collapses, ring-intersections, etc * and attempting to avoid. More computationally expensive than GEOSSimplify() +* Z values on the retained coordinates will be preserved. +* M values will not be preserved. * \param g The input geometry * \param tolerance The tolerance to apply. Larger tolerance leads to simpler output. * \return The simplified geometry @@ -5384,6 +5401,10 @@ extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify( * Return all distinct vertices of input geometry as a MultiPoint. * Note that only 2 dimensions of the vertices are considered when * testing for equality. +* +* Z values on the retained coordinates will be preserved. +* M values will not be preserved. +* * \param g The input geometry * \return The distinct points * Caller is responsible for freeing with GEOSGeom_destroy(). diff --git a/tests/unit/capi/GEOSConcaveHullTest.cpp b/tests/unit/capi/GEOSConcaveHullTest.cpp index 5411db1d0..2984418ed 100644 --- a/tests/unit/capi/GEOSConcaveHullTest.cpp +++ b/tests/unit/capi/GEOSConcaveHullTest.cpp @@ -61,4 +61,15 @@ void object::test<3>() ensure(result_ == nullptr); } +template<> +template<> +void object::test<4>() +{ + input_ = fromWKT("MULTIPOINT ZM (0 0 1 2, 1 0 3 4, 1 1 5 6, 1 8 11 4, 0.5 0.5 -4 -7)"); + result_ = GEOSConcaveHull(input_, 0, 0); + + printf("%s", toWKT(result_).c_str()); +} + + } // namespace tut diff --git a/tests/unit/capi/GEOSEnvelopeTest.cpp b/tests/unit/capi/GEOSEnvelopeTest.cpp index 99b603103..68f9317bf 100644 --- a/tests/unit/capi/GEOSEnvelopeTest.cpp +++ b/tests/unit/capi/GEOSEnvelopeTest.cpp @@ -17,7 +17,7 @@ struct test_geosenvelope_data : public capitest::utility input_ = fromWKT(wktIn); result_ = GEOSEnvelope(input_); expected_ = fromWKT(wktExp); - ensure_geometry_equals(result_, expected_, 0); + ensure_geometry_equals_identical(result_, expected_); } }; @@ -68,5 +68,41 @@ void object::test<4>() "POINT EMPTY"); } +template<> +template<> +void object::test<5>() +{ + set_test_name("POINT ZM"); + + checkEnvelope( + "POINT ZM (1 2 3 4)", + "POINT (1 2)" + ); +} + +template<> +template<> +void object::test<6>() +{ + set_test_name("LINESTRING ZM"); + + checkEnvelope( + "LINESTRING ZM (0 0 3 4, 5 0 7 8)", + "POLYGON ((0 0, 5 0, 5 0, 0 0, 0 0))" // collapsed polygon + ); +} + +template<> +template<> +void object::test<7>() +{ + set_test_name("POLYGON ZM"); + + checkEnvelope( + "POLYGON ZM ((0 0 1 2, 1 0 3 4, 1 1 5 6, 0 0 1 2))", + "POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))" // collapsed polygon + ); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp b/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp index 95ca4e05e..2ed116462 100644 --- a/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp +++ b/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp @@ -72,6 +72,20 @@ void object::test<4>() { ensure_geometry_equals(result_, "MULTIPOINT ((0 0), (1 1), (2 0))"); } +template <> +template <> +void object::test<5>() { + input_ = fromWKT("MULTIPOINT ZM (0 4 7 8, 0 4 11 12, 3 5 6 2)"); + ensure(input_); + + result_ = GEOSGeom_extractUniquePoints(input_); + ensure(result_); + + expected_ = fromWKT("MULTIPOINT Z (0 4 7, 3 5 6)"); + ensure(expected_); + + ensure_geometry_equals(expected_, result_); +} } // namespace tut diff --git a/tests/unit/capi/GEOSSimplifyTest.cpp b/tests/unit/capi/GEOSSimplifyTest.cpp index 1de11740b..3fe73e4a3 100644 --- a/tests/unit/capi/GEOSSimplifyTest.cpp +++ b/tests/unit/capi/GEOSSimplifyTest.cpp @@ -50,5 +50,21 @@ void object::test<2>() ensure(result_ == nullptr); } +template<> +template<> +void object::test<3>() +{ + set_test_name("LINESTRING ZM"); + + input_ = fromWKT("LINESTRING ZM (0 0 5 8, 1 1 6 2, 2 0 7 9)"); + ensure(input_); + + result_ = GEOSSimplify(input_, 2); + ensure(result_); + + expected_ = fromWKT("LINESTRING ZM (0 0 5 8, 2 0 7 9)"); + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSTopologyPreserveSimplifyTest.cpp b/tests/unit/capi/GEOSTopologyPreserveSimplifyTest.cpp index 1f6bdcb33..a6ada22d1 100644 --- a/tests/unit/capi/GEOSTopologyPreserveSimplifyTest.cpp +++ b/tests/unit/capi/GEOSTopologyPreserveSimplifyTest.cpp @@ -58,5 +58,21 @@ void object::test<3>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<4>() +{ + set_test_name("LINESTRING ZM"); + + input_ = fromWKT("LINESTRING ZM (0 0 5 8, 1 1 6 2, 2 0 7 9)"); + ensure(input_); + + result_ = GEOSTopologyPreserveSimplify(input_, 2); + ensure(result_); + + expected_ = fromWKT("LINESTRING Z (0 0 5, 2 0 7)"); + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 25 ++++++++++++-- tests/unit/capi/GEOSConcaveHullTest.cpp | 11 +++++++ tests/unit/capi/GEOSEnvelopeTest.cpp | 38 +++++++++++++++++++++- .../unit/capi/GEOSGeom_extractUniquePointsTest.cpp | 14 ++++++++ tests/unit/capi/GEOSSimplifyTest.cpp | 16 +++++++++ .../unit/capi/GEOSTopologyPreserveSimplifyTest.cpp | 16 +++++++++ 6 files changed, 117 insertions(+), 3 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 8 17:43:54 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 8 Mar 2026 17:43:54 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. a1ade8d631190782a6032f2105f4727ead0fb5f3 Message-ID: <20260309004357.17D071AA345@trac.osgeo.org> 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 a1ade8d631190782a6032f2105f4727ead0fb5f3 (commit) from 927e1df7e5f4202c64d986bb8ee858d53e5b71eb (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 a1ade8d631190782a6032f2105f4727ead0fb5f3 Author: Daniel Baston Date: Sun Mar 8 19:57:22 2026 -0400 C API: Add more comments/tests on Z/M handling diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 95a5e2600..21a85501f 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -5034,7 +5034,7 @@ extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth(const GEOSGeometry* g); /** -* Returns a point that is inside the boundary of a polygonal geometry. +* Returns a 2D point that is inside the boundary of a polygonal geometry. * \param g The input geometry * \return A point that is inside the input * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5045,7 +5045,7 @@ extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth(const GEOSGeometry* g); extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface(const GEOSGeometry* g); /** -* Returns a point at the center of mass of the input. +* Returns a 2D point at the center of mass of the input. * \param g The input geometry * \return A point at the center of mass of the input * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5056,7 +5056,7 @@ extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface(const GEOSGeometry* g); extern GEOSGeometry GEOS_DLL *GEOSGetCentroid(const GEOSGeometry* g); /** -* Returns a geometry which represents the "minimum bounding circle", +* Returns a 2D geometry which represents the "minimum bounding circle", * the smallest circle that contains the input. * \param[in] g The input geometry * \param[out] radius Pointer will be filled with output radius. @@ -5075,6 +5075,9 @@ extern GEOSGeometry GEOS_DLL *GEOSMinimumBoundingCircle( /** * Return a Delaunay triangulation of the vertices of the given geometry. * +* Z values from the input points will be propagated to the generated polygons. +* M values from the input points will be ignored. +* * \param g the input geometry whose vertices will be used as "sites" * \param tolerance optional snapping tolerance to use for improved robustness * \param onlyEdges if non-zero will return a MultiLineString, otherwise it will @@ -5095,6 +5098,9 @@ extern GEOSGeometry GEOS_DLL * GEOSDelaunayTriangulation( * given polygon(s). * For non-polygonal inputs, returns an empty geometry collection. * +* Z values from the input points will be propagated to the generated polygons. +* M values from the input points will be ignored. +* * \param g the input geometry whose rings will be used as input * \return A newly allocated geometry. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5116,7 +5122,8 @@ enum GEOSVoronoiFlags }; /** -* Returns the Voronoi polygons or edges of the vertices of the given geometry. +* Returns the 2D Voronoi polygons or edges computed from the vertices +* of the given geometry. * * \param g the input geometry whose vertices will be used as sites. * \param tolerance snapping tolerance to use for improved robustness. A @@ -5152,6 +5159,10 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram( /** * For linear inputs, returns a new geometry in which no lines cross * each other, and all touching occurs at end points. +* +* Z and M values of input coordinates will be preserved. +* Z and M values at constructed points will be interpolated. +* * \param g The input geometry * \return The noded geometry or NULL on exception * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5165,9 +5176,11 @@ extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g); * Polygonizes a set of Geometries which contain linework that * represents the edges of a planar graph. * -* All types of Geometry are accepted as input; the constituent +* All non-curved types of Geometry are accepted as input; the constituent * linework is extracted as the edges to be polygonized. * +* Z and M values from the input linework will be preserved. +* * The edges must be correctly noded; that is, they must only meet * at their endpoints and not overlap anywhere. If your edges are not * already noded, run them through GEOSUnaryUnion() first. @@ -5195,7 +5208,7 @@ extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g); * that the input lines form a valid polygonal geometry (which may * include holes or nested polygons). * -* \param geoms Array of linear geometries to polygons. Caller retains ownersihp of both array container and objects. +* \param geoms Array of linear geometries to polygons. Caller retains ownership of both array container and objects. * \param ngeoms Size of the geoms array. * \return The polygonal output geometry. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5212,7 +5225,7 @@ extern GEOSGeometry GEOS_DLL *GEOSPolygonize( * but returns a result which is a valid polygonal geometry. * The result will not contain any edge-adjacent elements. * -* \param geoms Array of linear geometries to polygons. Caller retains ownersihp of both array container and objects. +* \param geoms Array of linear geometries to polygons. Caller retains ownership of both array container and objects. * \param ngeoms Size of the geoms array. * \return The polygonal output geometry. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5287,7 +5300,8 @@ extern GEOSGeometry GEOS_DLL *GEOSBuildArea(const GEOSGeometry* g); * Densifies a geometry using a given distance tolerance. * Additional vertices will be added to every line segment * that is greater this tolerance; these vertices will -* evenly subdivide that segment. +* evenly subdivide that segment. Z and M values of added +* vertices will be interpolated. * Only linear components of input geometry are densified. * \param g The geometry to densify * \param tolerance the distance tolerance to densify @@ -5304,7 +5318,11 @@ extern GEOSGeometry GEOS_DLL *GEOSDensify( * Merges a set of LineStrings, * joining them at nodes which have cardinality 2. * Lines may have their direction reversed. - +* +* Z and M values from the input will be preserved. If the Z and M +* values differ at the points where two lines are joined, the values +* from one of the points will be selected. +* * \param g The input linework * \return The merged linework. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5318,7 +5336,11 @@ extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g); * joining them at nodes which have cardinality 2. * and where the lines have the same direction. * This means that lines do not have their direction reversed. - +* +* Z and M values from the input will be preserved. If the Z and M +* values differ at the points where two lines are joined, the values +* from one of the points will be selected. +* * \param g The input linework * \return The merged linework. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5331,6 +5353,10 @@ extern GEOSGeometry GEOS_DLL *GEOSLineMergeDirected(const GEOSGeometry* g); /** * Computes the line which is the section of the input LineString starting and * ending at the given length fractions. + * + * Z values will be interpolated from the input. + * M values from the input will be ignored. + * * \param g The input LineString * \param start_fraction start fraction (0-1) along the length of g * \param end_fraction end fraction (0-1) along the length of g @@ -5347,7 +5373,8 @@ extern GEOSGeometry GEOS_DLL *GEOSLineSubstring( /** * For geometries with coordinate sequences, reverses the order * of the sequences. Converts CCW rings to CW. Reverses direction -* of LineStrings. +* of LineStrings. Z and M values of the input coordinates are +* preserved. * \param g The input geometry * \return The reversed geometry * Caller is responsible for freeing with GEOSGeom_destroy(). diff --git a/tests/unit/capi/GEOSConstrainedDelaunayTriangulationTest.cpp b/tests/unit/capi/GEOSConstrainedDelaunayTriangulationTest.cpp index cee6d9019..51362108f 100644 --- a/tests/unit/capi/GEOSConstrainedDelaunayTriangulationTest.cpp +++ b/tests/unit/capi/GEOSConstrainedDelaunayTriangulationTest.cpp @@ -79,6 +79,21 @@ void object::test<4>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<5>() +{ + set_test_name("POLYGON ZM input"); + + input_ = fromWKT("POLYGON ZM ((0 0 4 3, 1 7 9 8, 6 2 6 2, 0 0 4 4))"); + ensure(input_); + + result_ = GEOSConstrainedDelaunayTriangulation(input_); + ensure(result_); + + ensure(GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); +} } // namespace tut diff --git a/tests/unit/capi/GEOSDelaunayTriangulationTest.cpp b/tests/unit/capi/GEOSDelaunayTriangulationTest.cpp index d685ae25b..f0f2ab077 100644 --- a/tests/unit/capi/GEOSDelaunayTriangulationTest.cpp +++ b/tests/unit/capi/GEOSDelaunayTriangulationTest.cpp @@ -134,5 +134,21 @@ void object::test<7>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<8>() +{ + set_test_name("MULTIPOINT ZM input"); + + input_ = fromWKT("MULTIPOINT ZM (0 0 4 3, 1 7 9 8, 6 2 6 2)"); + ensure(input_); + + result_ = GEOSDelaunayTriangulation(input_, 0, 0); + ensure(result_); + + ensure(GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSGetCentroidTest.cpp b/tests/unit/capi/GEOSGetCentroidTest.cpp index e0fc823fe..2e9b17b5c 100644 --- a/tests/unit/capi/GEOSGetCentroidTest.cpp +++ b/tests/unit/capi/GEOSGetCentroidTest.cpp @@ -145,5 +145,22 @@ void object::test<6>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<7>() +{ + set_test_name("Z/M dimensions ignored"); + + input_ = fromWKT("LINESTRING ZM (0 0 4 3, 2 6 9 1)"); + ensure(input_); + + result_ = GEOSGetCentroid(input_); + ensure(result_); + + expected_ = fromWKT("POINT (1 3)"); + ensure(expected_); + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSLineMergeDirectedTest.cpp b/tests/unit/capi/GEOSLineMergeDirectedTest.cpp index 1e145abc6..91a2e5072 100644 --- a/tests/unit/capi/GEOSLineMergeDirectedTest.cpp +++ b/tests/unit/capi/GEOSLineMergeDirectedTest.cpp @@ -70,5 +70,24 @@ void object::test<3>() ensure("curved geometries not supported", result_ == nullptr); } + +template<> +template<> +void object::test<4>() +{ + set_test_name("MULTILINESTRING ZM input"); + + input_ = fromWKT("MULTILINESTRING ZM ((0 0 4 5, 2 8 4 3), (2 8 8 6, 10 10 9 3))"); + ensure(input_); + + result_ = GEOSLineMergeDirected(input_); + ensure(result_); + + expected_ = fromWKT("LINESTRING ZM (0 0 4 5, 2 8 4 3, 10 10 9 3)"); + ensure(expected_); + + ensure_geometry_equals_identical(result_, expected_); +} + } // namesplace tut diff --git a/tests/unit/capi/GEOSLineMergeTest.cpp b/tests/unit/capi/GEOSLineMergeTest.cpp index 48817c074..ba728b82c 100644 --- a/tests/unit/capi/GEOSLineMergeTest.cpp +++ b/tests/unit/capi/GEOSLineMergeTest.cpp @@ -53,5 +53,23 @@ void object::test<2>() ensure("curved geometries not supported", result_ == nullptr); } +template<> +template<> +void object::test<3>() +{ + set_test_name("MULTILINESTRING ZM input"); + + input_ = fromWKT("MULTILINESTRING ZM ((0 0 4 5, 2 8 4 3), (2 8 8 6, 10 10 9 3))"); + ensure(input_); + + result_ = GEOSLineMerge(input_); + ensure(result_); + + expected_ = fromWKT("LINESTRING ZM (0 0 4 5, 2 8 4 3, 10 10 9 3)"); + ensure(expected_); + + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSLineSubstringTest.cpp b/tests/unit/capi/GEOSLineSubstringTest.cpp index 8135a75d5..9dbc7896b 100644 --- a/tests/unit/capi/GEOSLineSubstringTest.cpp +++ b/tests/unit/capi/GEOSLineSubstringTest.cpp @@ -85,22 +85,13 @@ template<> void object::test<5> () { - input_ = GEOSGeomFromWKT("LINESTRINGZ (0 0 0, 2 2 5)"); + set_test_name("Z dimension is interpolated, M dimension is dropped"); + + input_ = GEOSGeomFromWKT("LINESTRING ZM (0 0 0 0, 2 2 5 10)"); result_ = GEOSLineSubstring(input_, 0, 0.5); - expected_ = GEOSGeomFromWKT("LINESTRING (0 0 0, 1 1 2.5)"); + expected_ = GEOSGeomFromWKT("LINESTRING Z (0 0 0, 1 1 2.5)"); - ensure_geometry_equals(result_, expected_); - - // check 3rd dimension that isgnored by ensure_geometry_equals - ensure(GEOSHasZ(result_)); - auto seq = GEOSGeom_getCoordSeq(expected_); - - double z0, z1; - GEOSCoordSeq_getZ(seq, 0, &z0); - GEOSCoordSeq_getZ(seq, 1, &z1); - - ensure_equals(z0, 0); - ensure_equals(z1, 2.5); + ensure_geometry_equals_identical(result_, expected_); } // reversed fractions give a reversed substring diff --git a/tests/unit/capi/GEOSPointOnSurfaceTest.cpp b/tests/unit/capi/GEOSPointOnSurfaceTest.cpp index 0118234fa..de1ab2d3c 100644 --- a/tests/unit/capi/GEOSPointOnSurfaceTest.cpp +++ b/tests/unit/capi/GEOSPointOnSurfaceTest.cpp @@ -231,5 +231,20 @@ void object::test<10> ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<11>() +{ + set_test_name("Z/M values ignored"); + + input_ = fromWKT("POLYGON ZM ((0 0 4 2, 10 0 8 4, 10 10 12 6, 0 10 8 1, 0 0 4 2))"); + ensure(input_); + + result_ = GEOSPointOnSurface(input_); + ensure(result_); + ensure(!GEOSHasZ(result_)); + ensure(!GEOSHasM(result_)); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSPolygonizeTest.cpp b/tests/unit/capi/GEOSPolygonizeTest.cpp index 8ed9325bd..145743ccc 100644 --- a/tests/unit/capi/GEOSPolygonizeTest.cpp +++ b/tests/unit/capi/GEOSPolygonizeTest.cpp @@ -5,6 +5,8 @@ // geos #include +#include + #include "capi_test_utils.h" namespace tut { @@ -205,5 +207,28 @@ void object::test<7> } } +template<> +template<> +void object::test<8> +() +{ + set_test_name("LINESTRING ZM inputs"); + + geom1_ = fromWKT("LINESTRING ZM (0 0 5 4, 2 0 6 5, 2 2 7 6)"); + geom2_ = fromWKT("LINESTRING ZM (2 2 7 6, 0 0 5 4)"); + + ensure(geom1_); + ensure(geom2_); + + std::array geoms = {geom1_, geom2_}; + result_ = GEOSPolygonize(geoms.data(), geoms.size()); + ensure(result_); + + expected_ = fromWKT("GEOMETRYCOLLECTION ZM (POLYGON ZM ((2 2 7 6, 2 0 6 5, 0 0 5 4, 2 2 7 6)))"); + ensure(expected_); + + ensure_geometry_equals_identical(result_, expected_); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSReverseTest.cpp b/tests/unit/capi/GEOSReverseTest.cpp index cb8895d26..f2e618ee1 100644 --- a/tests/unit/capi/GEOSReverseTest.cpp +++ b/tests/unit/capi/GEOSReverseTest.cpp @@ -13,6 +13,22 @@ namespace tut { // Common data used in test cases. struct test_capigeosreverse : public capitest::utility { + void + testReverse(const std::string& wkt_input, + const std::string& wkt_output) + { + GEOSGeometry* input = GEOSGeomFromWKT(wkt_input.c_str()); + GEOSGeometry* expected_result = GEOSGeomFromWKT(wkt_output.c_str()); + GEOSGeometry* result = GEOSReverse(input); + + ensure(result != nullptr); + + ensure_geometry_equals_identical(result, expected_result); + + GEOSGeom_destroy(input); + GEOSGeom_destroy(expected_result); + GEOSGeom_destroy(result); + } }; typedef test_group group; @@ -20,21 +36,6 @@ typedef group::object object; group test_capigeosreverse_group("capi::GEOSReverse"); -void -testReverse(const std::string& wkt_input, - const std::string& wkt_output) -{ - GEOSGeometry* input = GEOSGeomFromWKT(wkt_input.c_str()); - GEOSGeometry* expected_result = GEOSGeomFromWKT(wkt_output.c_str()); - GEOSGeometry* result = GEOSReverse(input); - - ensure(result != nullptr); - ensure_equals(1, GEOSEqualsExact(result, expected_result, 0.0)); - - GEOSGeom_destroy(input); - GEOSGeom_destroy(expected_result); - GEOSGeom_destroy(result); -} // // Test Cases @@ -127,4 +128,13 @@ void object::test<9>() "CIRCULARSTRING (2 0, 1 1, 0 0)"); } +template<> +template<> +void object::test<10>() +{ + testReverse("POINT ZM (1 2 3 4)", "POINT ZM (1 2 3 4)"); + testReverse("LINESTRING ZM (1 2 3 4, 5 6 7 8)", "LINESTRING ZM (5 6 7 8, 1 2 3 4)"); + testReverse("POLYGON ZM ((1 2 3 4, 5 6 7 8, 9 10 11 12, 1 2 3 4))", "POLYGON ZM ((1 2 3 4, 9 10 11 12, 5 6 7 8, 1 2 3 4))"); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 49 +++++++++++++++++----- .../GEOSConstrainedDelaunayTriangulationTest.cpp | 15 +++++++ tests/unit/capi/GEOSDelaunayTriangulationTest.cpp | 16 +++++++ tests/unit/capi/GEOSGetCentroidTest.cpp | 17 ++++++++ tests/unit/capi/GEOSLineMergeDirectedTest.cpp | 19 +++++++++ tests/unit/capi/GEOSLineMergeTest.cpp | 18 ++++++++ tests/unit/capi/GEOSLineSubstringTest.cpp | 19 +++------ tests/unit/capi/GEOSPointOnSurfaceTest.cpp | 15 +++++++ tests/unit/capi/GEOSPolygonizeTest.cpp | 25 +++++++++++ tests/unit/capi/GEOSReverseTest.cpp | 40 +++++++++++------- 10 files changed, 193 insertions(+), 40 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Mon Mar 9 05:51:38 2026 From: git at osgeo.org (git at osgeo.org) Date: Mon, 9 Mar 2026 05:51:38 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 637142a36e34062f32fd2c94f7e37d2c8259becb Message-ID: <20260309125139.244D01B09FA@trac.osgeo.org> 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 637142a36e34062f32fd2c94f7e37d2c8259becb (commit) from a1ade8d631190782a6032f2105f4727ead0fb5f3 (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 637142a36e34062f32fd2c94f7e37d2c8259becb Author: Daniel Baston Date: Mon Mar 9 08:51:17 2026 -0400 CurvePolygon: throw construction exception on non-closed ring (#1393) diff --git a/include/geos/geom/Surface.h b/include/geos/geom/Surface.h index d2dcb384e..35e0d9cf1 100644 --- a/include/geos/geom/Surface.h +++ b/include/geos/geom/Surface.h @@ -109,6 +109,8 @@ protected: void geometryChangedAction() override {} + void validateConstruction() const; + }; } diff --git a/include/geos/geom/SurfaceImpl.h b/include/geos/geom/SurfaceImpl.h index 60da401ef..fc66a1a87 100644 --- a/include/geos/geom/SurfaceImpl.h +++ b/include/geos/geom/SurfaceImpl.h @@ -70,6 +70,8 @@ protected: if (shell == nullptr) { shell.reset(static_cast(createEmptyRing(newFactory).release())); } + + validateConstruction(); } SurfaceImpl(std::unique_ptr&& newShell, @@ -83,12 +85,7 @@ protected: shell.reset(static_cast(createEmptyRing(newFactory).release())); } - if(shell->isEmpty() && hasNonEmptyElements(&holes)) { - throw geos::util::IllegalArgumentException("shell is empty but holes are not"); - } - if (hasNullElements(&holes)) { - throw geos::util::IllegalArgumentException("holes must not contain null elements"); - } + validateConstruction(); } public: diff --git a/src/geom/Surface.cpp b/src/geom/Surface.cpp index 34bb5c601..9a5d66277 100644 --- a/src/geom/Surface.cpp +++ b/src/geom/Surface.cpp @@ -282,5 +282,30 @@ Surface::isEmpty() const return getExteriorRing()->isEmpty(); } +void +Surface::validateConstruction() const +{ + const bool shellIsEmpty = getExteriorRing()->isEmpty(); + + if (!shellIsEmpty && !getExteriorRing()->isClosed()) { + throw util::IllegalArgumentException("Exterior ring is not closed"); + } + + for (std::size_t i = 0 ; i < getNumInteriorRing(); i++) { + const Curve* hole = getInteriorRingN(i); + + if (hole == nullptr) { + throw util::IllegalArgumentException("holes must not contain null elements"); + } + + if (shellIsEmpty && !hole->isEmpty()) { + throw util::IllegalArgumentException("shell is empty but holes are not"); + } + + if (!hole->isClosed()) { + throw util::IllegalArgumentException("Hole is not closed"); + } + } +} } } diff --git a/tests/unit/capi/GEOSisValidDetailTest.cpp b/tests/unit/capi/GEOSisValidDetailTest.cpp index 4c0c12e9e..a4f8e3a38 100644 --- a/tests/unit/capi/GEOSisValidDetailTest.cpp +++ b/tests/unit/capi/GEOSisValidDetailTest.cpp @@ -144,7 +144,7 @@ template<> template<> void object::test<7>() { - input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 1 1)))"); + input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 0 0)))"); ensure(input_ != nullptr); char ret = GEOSisValidDetail(input_, 0, nullptr, nullptr); diff --git a/tests/unit/capi/GEOSisValidReasonTest.cpp b/tests/unit/capi/GEOSisValidReasonTest.cpp index fbd988e59..e3146c443 100644 --- a/tests/unit/capi/GEOSisValidReasonTest.cpp +++ b/tests/unit/capi/GEOSisValidReasonTest.cpp @@ -61,7 +61,7 @@ template<> template<> void object::test<7>() { - input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 1 1)))"); + input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 0 0)))"); ensure(input_ != nullptr); char* reason = GEOSisValidReason(input_); diff --git a/tests/unit/capi/GEOSisValidTest.cpp b/tests/unit/capi/GEOSisValidTest.cpp index a71fc5150..046a53feb 100644 --- a/tests/unit/capi/GEOSisValidTest.cpp +++ b/tests/unit/capi/GEOSisValidTest.cpp @@ -68,7 +68,7 @@ template<> template<> void object::test<5>() { - input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 1 1)))"); + input_ = fromWKT("CURVEPOLYGON (COMPOUNDCURVE( CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 0 0)))"); ensure(input_ != nullptr); char ret = GEOSisValid(input_); diff --git a/tests/unit/geom/CurvePolygonTest.cpp b/tests/unit/geom/CurvePolygonTest.cpp index 774a8bb32..ebddf3328 100644 --- a/tests/unit/geom/CurvePolygonTest.cpp +++ b/tests/unit/geom/CurvePolygonTest.cpp @@ -198,4 +198,41 @@ void object::test<4>() ensure_equals("cpRev->getArea()", cpRev->getArea(), 9.8185835, 1e-6); } +template<> +template<> +void object::test<5>() +{ + set_test_name("construction error on non-closed ring"); + + auto seq = std::make_unique(3); + seq->setAt(CoordinateXY{0, 0}, 0); + seq->setAt(CoordinateXY{1, 1}, 1); + seq->setAt(CoordinateXY{2, 0}, 2); + auto cs = factory_->createCircularString(std::move(seq)); + + seq = std::make_unique(2); + seq->setAt(CoordinateXY{2, 0}, 0); + seq->setAt(CoordinateXY{1, 0}, 1); + auto ls = factory_->createLineString(std::move(seq)); + + std::vector> curves; + curves.push_back(std::move(cs)); + curves.push_back(std::move(ls)); + + auto cc = factory_->createCompoundCurve(std::move(curves)); + + // shell is non-closed + ensure_THROW(factory_->createCurvePolygon(std::move(cc)), geos::util::IllegalArgumentException); + + geos::geom::Envelope shellEnv(-100, 100, -100, 100); + auto shell = static_cast(factory_->toGeometry(&shellEnv).get())->getExteriorRing()->clone(); + + std::vector> holes; + holes.push_back(std::move(cc)); + + // hole is non-cloesd + ensure_THROW(factory_->createCurvePolygon(std::move(shell), std::move(holes)), geos::util::IllegalArgumentException); +} + + } ----------------------------------------------------------------------- Summary of changes: include/geos/geom/Surface.h | 2 ++ include/geos/geom/SurfaceImpl.h | 9 +++----- src/geom/Surface.cpp | 25 +++++++++++++++++++++ tests/unit/capi/GEOSisValidDetailTest.cpp | 2 +- tests/unit/capi/GEOSisValidReasonTest.cpp | 2 +- tests/unit/capi/GEOSisValidTest.cpp | 2 +- tests/unit/geom/CurvePolygonTest.cpp | 37 +++++++++++++++++++++++++++++++ 7 files changed, 70 insertions(+), 9 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Mon Mar 9 06:21:19 2026 From: git at osgeo.org (git at osgeo.org) Date: Mon, 9 Mar 2026 06:21:19 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 88a40b383ef4bb30fd72f8ac3f255bfc7060ead7 Message-ID: <20260309132119.A129E1B0960@trac.osgeo.org> 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 88a40b383ef4bb30fd72f8ac3f255bfc7060ead7 (commit) from 637142a36e34062f32fd2c94f7e37d2c8259becb (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 88a40b383ef4bb30fd72f8ac3f255bfc7060ead7 Author: Daniel Baston Date: Mon Mar 9 09:20:40 2026 -0400 NEWS updates diff --git a/NEWS.md b/NEWS.md index 187b4781c..3f8bf9b43 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,15 +3,27 @@ 2026-xx-xx - New things: - - + - Add new C API functions for Hausdorff distance (GH-1352, Sven Jensen) + - Add GEOSSubdivideByGrid (GH-1232, Dan Baston) - Breaking Changes: - BufferOp returns POLYGON EMPTY when fed Inf/Nan coords (GH-1332) + - Return Inf when calculating distance to an empty geometry (GH-1345, Even Rouault) + - Fixes/Improvements: - Buffer of Linestring includes spurious hole (GH-1217, Moritz Kirmse) - - + - Preserve M values in GEOSInterpolate (GH-1390, Dan Baston) + - Preserve M values in GEOSLineMerge (GH-1364, Dan Baston) + - Preserve M values in GEOSCoverageSimplify (GH-1384, Paul Ramsey) + - Preserve M values in GEOSDensify (GH-1319, Dan Baston) + - Preserve M values in GEOSSimplify (GH-1317, Dan Baston) + - Preserve M values in GEOSPolygonize (GH-1363 Dan Baston) + - Fix some cases of dropped M values in overlay (GH-1364/GH-1388, Dan Baston) + - Support curved inputs in GEOSNode (GH-1347, Dan Baston) + - GEOSClusterDBSCAN fix unsassigned clusters with minPoints <= 1 (GH-1386, Dan Baston) + - Fix crash in GEOSConvexHull (GH-1358, Dan Baston) + - Overlay performance improvements (GH-1353, arriopolis, Martin Davis) ## Changes in 3.14.0 2025-08-21 ----------------------------------------------------------------------- Summary of changes: NEWS.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Mon Mar 9 07:43:59 2026 From: git at osgeo.org (git at osgeo.org) Date: Mon, 9 Mar 2026 07:43:59 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.14 updated. 2b48c043c11a15beb8d2e0ca4efe004be171bd42 Message-ID: <20260309144359.F3BC11B04FE@trac.osgeo.org> 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, 3.14 has been updated via 2b48c043c11a15beb8d2e0ca4efe004be171bd42 (commit) via fcb9b9242b1675a549ad90ac4502a1638f25e083 (commit) via 4929cd265831da7db2d92d3e62cd39f654f6a594 (commit) via c94148de2df6a038e2482fa695a21b41c565e661 (commit) via bb6b293bc0e29a54979b0d59d41de08a9619ca53 (commit) via 9cce057baae8dd044981cdd696eb541eacfafc4a (commit) via d93a5397e614d4298342f3851af11c11dbd1780f (commit) from 25e08d264b9a1eb2267e76207da7995cf8c8254c (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 2b48c043c11a15beb8d2e0ca4efe004be171bd42 Author: Daniel Baston Date: Mon Mar 9 09:41:03 2026 -0400 NEWS updates diff --git a/NEWS.md b/NEWS.md index c77fa6a50..08b2802a4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,11 +1,13 @@ - ## Changes in 3.14.2 -2025-xx-xx +2026-xx-xx - Fixes/Improvements: - Relax other floating-point exception handling with other compilers (GH-1333, Mike Taves) - Quiet FP_DIVBYZERO exception from CGAlgorithmsDD::intersection (GH-1235, Paul Ramsey) - Avoid crash on buffer of geometry with only invalid coordinates (GH-1335, Dan Baston) + - Fix some cases of dropped M values in overlay (GH-1364/GH-1388, Dan Baston) + - GEOSClusterDBSCAN fix unassigned clusters with minPoints <= 1 (GH-1386, Dan Baston) + - Fix crash in GEOSConvexHull (GH-1358, Dan Baston) ## Changes in 3.14.1 2025-10-27 commit fcb9b9242b1675a549ad90ac4502a1638f25e083 Author: Daniel Baston Date: Sat Mar 7 21:01:55 2026 -0500 SegmentNodeList: Preserve Z/M in mixed-dimension overlay (#1388) diff --git a/src/noding/SegmentNodeList.cpp b/src/noding/SegmentNodeList.cpp index 962f4a7c3..46caa5358 100644 --- a/src/noding/SegmentNodeList.cpp +++ b/src/noding/SegmentNodeList.cpp @@ -280,6 +280,14 @@ SegmentNodeList::createSplitEdgePts(const SegmentNode* ei0, const SegmentNode* e pts->add(*edgeCoords, ei0->segmentIndex + 1, ei1->segmentIndex); if (useIntPt1) { pts->add(ei1->coord); + } else if (ei1->coord.equals2D(lastSegStartPt)) { + // Can we pick up Z/M values from ei1 that weren't present in edgeCoords? + if (constructZ && !edgeCoords->hasZ() && !std::isnan(ei1->coord.z)) { + pts->setZ(pts->size() - 1, ei1->coord.z); + } + if (constructM && !edgeCoords->hasM() && !std::isnan(ei1->coord.m)) { + pts->setM(pts->size() - 1, ei1->coord.m); + } } assert(pts->size() == npts); diff --git a/tests/unit/capi/GEOSSharedPathsTest.cpp b/tests/unit/capi/GEOSSharedPathsTest.cpp index e1708d938..4316500ed 100644 --- a/tests/unit/capi/GEOSSharedPathsTest.cpp +++ b/tests/unit/capi/GEOSSharedPathsTest.cpp @@ -99,5 +99,40 @@ void object::test<4>() ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<5>() { + set_test_name("Z/M values taken from first input"); + + geom1_ = fromWKT("LINESTRING ZM (0 1 5 4, 0 0 6 5, 1 0 7 6, 1 1 8 7)"); + geom2_ = fromWKT("LINESTRING ZM (0 -1 3 8, 0 0 2 9, 1 0 1 10, 1 -1 0 11)"); + + ensure(geom1_); + ensure(geom2_); + + result_ = GEOSSharedPaths(geom1_, geom2_); + + expected_ = fromWKT("GEOMETRYCOLLECTION(MULTILINESTRING ZM ((0 0 6 5, 1 0 7 6)), MULTILINESTRING EMPTY)"); + ensure_geometry_equals_identical(result_, expected_); +} + +template<> +template<> +void object::test<6>() { + set_test_name("Z/M values taken from second input"); + + geom1_ = fromWKT("LINESTRING (0 1, 0 0, 1 0, 1 1)"); + geom2_ = fromWKT("LINESTRING ZM (0 -1 3 8, 0 0 2 9, 1 0 1 10, 1 -1 0 11)"); + + ensure(geom1_); + ensure(geom2_); + + result_ = GEOSSharedPaths(geom1_, geom2_); + + expected_ = fromWKT("GEOMETRYCOLLECTION(MULTILINESTRING ZM ((0 0 2 9, 1 0 1 10)), MULTILINESTRING EMPTY)"); + ensure_geometry_equals_identical(result_, expected_); +} + + } // namespace tut diff --git a/tests/unit/operation/overlayng/OverlayNGZTest.cpp b/tests/unit/operation/overlayng/OverlayNGZTest.cpp index 9769a7be0..e9ee46377 100644 --- a/tests/unit/operation/overlayng/OverlayNGZTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGZTest.cpp @@ -294,4 +294,26 @@ void object::test<19>() "POINT M (5 5 99)"); } +template<> +template<> +void object::test<20>() +{ + set_test_name("LINESTRING / LINESTRING ZM intersection"); + + checkIntersection("LINESTRING (0 0, 1 0)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)"); +} + +template<> +template<> +void object::test<21>() +{ + set_test_name("LINESTRING M / LINESTRING Z intersection"); + + checkIntersection("LINESTRING M (0 0 9, 1 0 7)", + "LINESTRING Z (1 0 5, 0 0 2)", + "LINESTRING ZM (0 0 2 9, 1 0 5 7)"); +} + } // namespace tut commit 4929cd265831da7db2d92d3e62cd39f654f6a594 Author: Daniel Baston Date: Mon Jan 12 10:20:23 2026 -0500 CoordinateSequence: Add Z/M accessors diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h index 2d952f137..0fb3b604a 100644 --- a/include/geos/geom/CoordinateSequence.h +++ b/include/geos/geom/CoordinateSequence.h @@ -337,6 +337,80 @@ public: return m_vect[index * stride() + 1]; } + /** + * Returns ordinate Z of the specified coordinate. + * + * @param index + * @return the value of the Z ordinate in the index'th coordinate, or NaN if the + * CoordinateSequence does not store Z values + */ + double getZ(std::size_t index) const + { + return getOrdinate(index, Z); + } + + /** + * Returns ordinate M of the specified coordinate. + * + * @param index + * @return the value of the M ordinate in the index'th coordinate, or NaN if the + * CoordinateSequence does not store M values + */ + double getM(std::size_t index) const + { + return getOrdinate(index, M); + } + + /** + * Set the X value of the specified coordinate. + * + * @param index + * @param x the new X value + */ + void setX(std::size_t index, double x) + { + m_vect[index * stride()] = x; + } + + /** + * Set the Y value of the specified coordinate. + * + * @param index + * @param y the new Y value + */ + void setY(std::size_t index, double y) + { + m_vect[index * stride() + 1] = y; + } + + /** + * Set the Z value of the specified coordinate. + * + * Has no effect if the CoordinateSequence does not store Z values. + * + * @param index + * @param z the new Z value + */ + void setZ(std::size_t index, double z) + { + if (hasZ()) + setOrdinate(index, Z, z); + } + + /** + * Set the M value of the specified coordinate. + * + * Has no effect if the CoordinateSequence does not store M values. + * + * @param index + * @param m the new M value + */ + void setM(std::size_t index, double m) + { + if (hasM()) + setOrdinate(index, M, m); + } + /// Return last Coordinate in the sequence template const T& back() const diff --git a/tests/unit/geom/CoordinateSequenceTest.cpp b/tests/unit/geom/CoordinateSequenceTest.cpp index 4786c20c8..b0d28fc6d 100644 --- a/tests/unit/geom/CoordinateSequenceTest.cpp +++ b/tests/unit/geom/CoordinateSequenceTest.cpp @@ -1536,4 +1536,41 @@ void object::test<56> ensure_equals_xyz(seq1.getAt(3), Coordinate{10, 11, DoubleNotANumber}); } +template<> +template<> +void object::test<60>() +{ + set_test_name("Z/M accessors on XY sequence"); + + CoordinateSequence seq(0, false, false); + seq.add(CoordinateXY{0, 0}); + seq.add(CoordinateXY{3, 0}); + + seq.setZ(0, 500); + seq.setM(0, 501); + + ensure(std::isnan(seq.getZ(0))); + ensure(std::isnan(seq.getM(0))); +} + +template<> +template<> +void object::test<61>() +{ + set_test_name("Z/M accessors on XYZM sequence"); + + CoordinateSequence seq(0, true, true); + seq.add(CoordinateXY{0, 0}); + seq.add(CoordinateXY{3, 0}); + + seq.setZ(0, 500); + seq.setM(0, 501); + + ensure_equals(seq.getZ(0), 500); + ensure_equals(seq.getM(0), 501); + + ensure(std::isnan(seq.getZ(1))); + ensure(std::isnan(seq.getM(1))); +} + } // namespace tut commit c94148de2df6a038e2482fa695a21b41c565e661 Author: Daniel Baston Date: Sat Mar 7 20:10:21 2026 -0500 DBSCAN: Fix unassigned clusters with minPoints <= 1 (#1386) diff --git a/src/operation/cluster/DBSCANClusterFinder.cpp b/src/operation/cluster/DBSCANClusterFinder.cpp index 1a87eb887..15da6c012 100644 --- a/src/operation/cluster/DBSCANClusterFinder.cpp +++ b/src/operation/cluster/DBSCANClusterFinder.cpp @@ -44,8 +44,10 @@ Clusters DBSCANClusterFinder::process(const std::vector & index::strtree::TemplateSTRtree & tree, UnionFind & uf) { - std::vector in_a_cluster(components.size()); - std::vector is_in_core(components.size()); + const bool allInputsInCluster = m_minPoints <= 1; + + std::vector in_a_cluster(components.size(), allInputsInCluster); + std::vector is_in_core(components.size(), allInputsInCluster); std::vector hits; std::vector neighbors; @@ -59,7 +61,7 @@ Clusters DBSCANClusterFinder::process(const std::vector & }); if (hits.size() < m_minPoints) { - // We didn't find enough points do do anything even if they're all within eps. + // We didn't find enough points to do anything even if they're all within eps. continue; } diff --git a/tests/unit/capi/GEOSClusterTest.cpp b/tests/unit/capi/GEOSClusterTest.cpp index f96d91ce5..c8136720f 100644 --- a/tests/unit/capi/GEOSClusterTest.cpp +++ b/tests/unit/capi/GEOSClusterTest.cpp @@ -105,6 +105,8 @@ template<> template<> void object::test<2>() { + set_test_name("DBSCAN"); + input_ = fromWKT( "GEOMETRYCOLLECTION (" "POINT (0 0)," @@ -118,6 +120,24 @@ void object::test<2>() "POINT ( 3 0.1)" ")"); + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.01, 0); + ensure_equals("nine clusters with eps=0.01, minPoints = 0", GEOSClusterInfo_getNumClusters(clusters), 9u); + GEOSClusterInfo_destroy(clusters); + } + + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.01, 1); + ensure_equals("nine clusters with eps=0.01, minPoints = 1", GEOSClusterInfo_getNumClusters(clusters), 9u); + GEOSClusterInfo_destroy(clusters); + } + + { + GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 0.1, 1); + ensure_equals("five clusters with eps=0.1, minPoints = 1", GEOSClusterInfo_getNumClusters(clusters), 5u); + GEOSClusterInfo_destroy(clusters); + } + { GEOSClusterInfo* clusters = GEOSClusterDBSCAN(input_, 1.01, 5); ensure_equals("two clusters with minPoints = 5", GEOSClusterInfo_getNumClusters(clusters), 2u); commit bb6b293bc0e29a54979b0d59d41de08a9619ca53 Author: Daniel Baston Date: Tue Jan 13 16:50:29 2026 -0500 LineDissolver: Create geometries with dimensions matching input (#1373) diff --git a/include/geos/dissolve/LineDissolver.h b/include/geos/dissolve/LineDissolver.h index cfae61f80..42ff86c3b 100644 --- a/include/geos/dissolve/LineDissolver.h +++ b/include/geos/dissolve/LineDissolver.h @@ -83,6 +83,8 @@ private: std::vector> lines; std::stack nodeEdgeStack; DissolveHalfEdge* ringStartEdge = nullptr; + bool constructZ = false; + bool constructM = false; void computeResult(); diff --git a/src/dissolve/LineDissolver.cpp b/src/dissolve/LineDissolver.cpp index 2c036cc0d..66a4322b8 100644 --- a/src/dissolve/LineDissolver.cpp +++ b/src/dissolve/LineDissolver.cpp @@ -87,6 +87,9 @@ LineDissolver::add(const LineString* lineString) factory = lineString->getFactory(); } const CoordinateSequence* seq = lineString->getCoordinatesRO(); + constructZ |= seq->hasZ(); + constructM |= seq->hasM(); + bool doneStart = false; for (std::size_t i = 1; i < seq->size(); i++) { CoordinateXYZM orig, dest; @@ -235,7 +238,7 @@ LineDissolver::buildLine(HalfEdge* eStart) void LineDissolver::buildRing(HalfEdge* eStartRing) { - std::unique_ptr line(new CoordinateSequence(0, 4)); + std::unique_ptr line(new CoordinateSequence(0, constructZ, constructM)); HalfEdge* e = eStartRing; // add first node diff --git a/tests/unit/coverage/CoverageCleanerTest.cpp b/tests/unit/coverage/CoverageCleanerTest.cpp index f36f1f887..de0b634db 100644 --- a/tests/unit/coverage/CoverageCleanerTest.cpp +++ b/tests/unit/coverage/CoverageCleanerTest.cpp @@ -77,6 +77,8 @@ struct test_coveragecleaner_data { { ensure_equals("checkEqual sizes", actual.size(), expected.size()); for (std::size_t i = 0; i < actual.size(); i++) { + ensure_equals("hasZ does not match", actual[i]->hasZ(), expected[i]->hasZ()); + ensure_equals("hasM does not match", actual[i]->hasM(), expected[i]->hasM()); ensure_equals_geometry(actual[i], expected[i]); } } commit 9cce057baae8dd044981cdd696eb541eacfafc4a Author: Daniel Baston Date: Tue Jan 13 16:56:28 2026 -0500 OverlayEdgeRing: Preserve M values when closing ring (#1372) Resolves https://github.com/libgeos/geos/issues/1365 diff --git a/src/operation/overlayng/OverlayEdgeRing.cpp b/src/operation/overlayng/OverlayEdgeRing.cpp index f45d46418..683f340d1 100644 --- a/src/operation/overlayng/OverlayEdgeRing.cpp +++ b/src/operation/overlayng/OverlayEdgeRing.cpp @@ -122,7 +122,7 @@ void OverlayEdgeRing::closeRing(CoordinateSequence& pts) { if(pts.size() > 0) { - pts.add(pts.getAt(0), false); + pts.closeRing(false); } } diff --git a/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp b/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp index 4640b19e7..4c604a183 100644 --- a/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp +++ b/tests/unit/capi/GEOSGeom_setPrecisionTest.cpp @@ -326,5 +326,20 @@ void object::test<23>() checkPrecision(wkt, 100000, "LINESTRING ( 700000 200000, 700000 1400000)"); } +template<> +template<> +void object::test<24>() +{ + // https://github.com/libgeos/geos/issues/1365{ + set_test_name("M value retained on last point"); + + input_ = fromWKT("POLYGON ZM ((0 0 0 0, 0 1 1 1, 1 1 2 3, 1 0 4 5, 0 0 6 7))"); + expected_ = fromWKT("POLYGON ZM ((0 1 1 1, 1 1 2 3, 1 0 4 5, 0 0 6 7, 0 1 1 1))"); + + result_ = GEOSGeom_setPrecision(input_, 0.1, 0); + + ensure(GEOSEqualsIdentical(result_, expected_)); +} + } // namespace tut commit d93a5397e614d4298342f3851af11c11dbd1780f Author: Daniel Baston Date: Mon Mar 9 09:26:05 2026 -0400 ConvexHull: improve robustness of polarCompare diff --git a/src/algorithm/ConvexHull.cpp b/src/algorithm/ConvexHull.cpp index 7d8e34374..1ed617438 100644 --- a/src/algorithm/ConvexHull.cpp +++ b/src/algorithm/ConvexHull.cpp @@ -63,13 +63,21 @@ private: polarCompare(const Coordinate* o, const Coordinate* p, const Coordinate* q) { - int orient = Orientation::index(*o, *p, *q); + // To use this comparator in std::sort it must provide a stable ordering, such that + // if cmp(a, b) is true then cmp(b, a) is false. Unfortunately Orientation::index may + // not provide this guarantee when the inputs differ by many orders of magnitude. To + // guard against this, we normalize the order of P and Q before calling OrientationIndex + // and flip the result if the inputs were flipped. + const bool swap = geom::CoordinateLessThan()(p, q); + + const int orient = swap ? Orientation::index(*o, *q, *p) : Orientation::index(*o, *p, *q); if(orient == Orientation::COUNTERCLOCKWISE) { - return 1; + return swap ? -1 : 1; } + if(orient == Orientation::CLOCKWISE) { - return -1; + return swap ? 1 : -1; } /** @@ -102,7 +110,7 @@ public: RadiallyLessThen(const Coordinate* c): origin(c) {} bool - operator()(const Coordinate* p1, const Coordinate* p2) + operator()(const Coordinate* p1, const Coordinate* p2) const { return (polarCompare(origin, p1, p2) == -1); } diff --git a/tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp b/tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp index f535fce86..3634752e9 100644 --- a/tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp +++ b/tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp @@ -129,5 +129,20 @@ void object::test<5> ensure("curved geometry not supported", result_ == nullptr); } +template<> +template<> +void object::test<6> +() +{ + set_test_name("https://github.com/libgeos/geos/issues/1072"); + + geom1_ = fromWKT("LINESTRING(7777777777777777770 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777770 1, 1 7 1,-2 1 2)"); + geom2_ = GEOSSingleSidedBuffer(geom1_, 1.0, 64, 1, 1.0, 1); + result_ = GEOSMinimumBoundingCircle(geom2_, NULL, NULL); + + // no segfault +} + + } // namespace tut ----------------------------------------------------------------------- Summary of changes: NEWS.md | 6 +- include/geos/dissolve/LineDissolver.h | 2 + include/geos/geom/CoordinateSequence.h | 74 +++++++++++++++++++++++ src/algorithm/ConvexHull.cpp | 16 +++-- src/dissolve/LineDissolver.cpp | 5 +- src/noding/SegmentNodeList.cpp | 8 +++ src/operation/cluster/DBSCANClusterFinder.cpp | 8 ++- src/operation/overlayng/OverlayEdgeRing.cpp | 2 +- tests/unit/capi/GEOSClusterTest.cpp | 20 ++++++ tests/unit/capi/GEOSGeom_setPrecisionTest.cpp | 15 +++++ tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp | 15 +++++ tests/unit/capi/GEOSSharedPathsTest.cpp | 35 +++++++++++ tests/unit/coverage/CoverageCleanerTest.cpp | 2 + tests/unit/geom/CoordinateSequenceTest.cpp | 37 ++++++++++++ tests/unit/operation/overlayng/OverlayNGZTest.cpp | 22 +++++++ 15 files changed, 256 insertions(+), 11 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Mon Mar 9 08:54:47 2026 From: git at osgeo.org (git at osgeo.org) Date: Mon, 9 Mar 2026 08:54:47 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 701457b424a834b7da398d6abb60c642addce642 Message-ID: <20260309155448.49F691B0B5C@trac.osgeo.org> 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 701457b424a834b7da398d6abb60c642addce642 (commit) from 88a40b383ef4bb30fd72f8ac3f255bfc7060ead7 (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 701457b424a834b7da398d6abb60c642addce642 Author: Mike Taves Date: Tue Mar 10 04:54:25 2026 +1300 CI: update various GitHub Actions (#1392) * CI: update various GitHub Actions * Simplify run commands use use cmake -S . -B build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37b039887..5885f3b90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -188,11 +188,10 @@ jobs: python3 -m pip install --disable-pip-version-check --user cmake==${{ matrix.ci.cmake }} echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -205,8 +204,6 @@ jobs: CXXFLAGS: "-m${{ matrix.ci.arch }}" run: | set -e - mkdir build - cd build cmake --version cmake ${{ matrix.ci.cmake_extra }} \ -D CMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} \ @@ -215,13 +212,13 @@ jobs: -D CMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} \ -D BUILD_DOCUMENTATION=YES \ -D USE_CCACHE=ON \ - .. - make -j $(nproc) - cmake --build . --target docs + -S . -B build + cmake --build build -j $(nproc) + cmake --build build --target docs ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -243,7 +240,7 @@ jobs: - name: 'Upload Valgrind Log' if: failure() - uses: actions/upload-artifact at v4 + uses: actions/upload-artifact at v7 with: name: valgrind-log path: build/Testing/Temporary/MemoryChecker.**.log @@ -251,8 +248,8 @@ jobs: - name: Generate coverage report if: matrix.ci.build_type == 'Coverage' + working-directory: ./build run: | - cd build lcov --ignore-errors=gcov,negative --capture --directory CMakeFiles --output-file coverage.info - name: Upload Coverage to Codecov @@ -275,8 +272,7 @@ jobs: build_type: ['Debug', 'Release'] steps: - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -290,8 +286,8 @@ jobs: mingw-w64-x86_64-gcc - name: Retrieve build cache + uses: actions/cache/restore at v5 id: restore-cache - uses: actions/cache/restore at v4 with: path: .ccache key: windows-mingw-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }} @@ -301,19 +297,17 @@ jobs: env: CCACHE_DIR: ${{ github.workspace }}\.ccache run: | - mkdir build - cd build cmake --version cmake \ -G "MSYS Makefiles" \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type}} \ -D USE_CCACHE=ON \ - .. - cmake --build . -j 4 + -S . -B build + cmake --build build -j 4 ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -334,16 +328,13 @@ jobs: arch: arm64 steps: - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 # ccache not supported for this generator and/or Debug - name: 'Build' shell: cmd run: | - md build - cd build cmake --version cmake ^ -G "Visual Studio 17 2022" ^ @@ -351,9 +342,9 @@ jobs: -D CMAKE_BUILD_TYPE=Debug ^ -D CMAKE_CXX_STANDARD=17 ^ -D BUILD_SHARED_LIBS=ON ^ - .. + -S . -B build IF %ERRORLEVEL% NEQ 0 exit /B 1 - cmake --build . --config Debug -j 4 -- /p:CL_MPcount=4 + cmake --build build --config Debug -j 4 -- /p:CL_MPcount=4 - name: 'Test' working-directory: build @@ -378,12 +369,11 @@ jobs: runs-on: ${{ matrix.ci.os }} steps: - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: Retrieve build cache + uses: actions/cache/restore at v5 id: restore-cache - uses: actions/cache/restore at v4 with: path: .ccache key: msvc-ninja-${{ matrix.ci.os }}-${{ matrix.ci.cxxstd }}-${{ matrix.ci.arch }}-${{ github.ref_name }}-${{ github.run_id }} @@ -402,8 +392,6 @@ jobs: CCACHE_DIR: ${{ github.workspace }}\.ccache shell: cmd run: | - md build - cd build cmake --version cmake ^ -G Ninja ^ @@ -411,14 +399,14 @@ jobs: -D CMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} ^ -D BUILD_SHARED_LIBS=ON ^ -D USE_CCACHE=ON ^ - .. + -S . -B build IF %ERRORLEVEL% NEQ 0 exit /B 1 - cmake --build . --config Release -j 4 + cmake --build build --config Release -j 4 IF %ERRORLEVEL% NEQ 0 exit /B 1 ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -462,12 +450,11 @@ jobs: which clang++ clang++ --version - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: Retrieve build cache + uses: actions/cache/restore at v5 id: restore-cache - uses: actions/cache/restore at v4 with: path: .ccache key: ${{ runner.os }}-${{ matrix.xcode }}-${{ matrix.build_type}}-${{ matrix.cxxstd }}-${{ github.ref_name }}-${{ github.run_id }} @@ -476,19 +463,17 @@ jobs: - name: 'Build' run: | set -e - mkdir build - cd build cmake --version cmake \ -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -D CMAKE_CXX_STANDARD=${{ matrix.cxxstd }} \ -D USE_CCACHE=ON \ - .. - cmake --build . --config ${{ matrix.build_type }} -j 4 + -S . -B build + cmake --build build --config ${{ matrix.build_type }} -j 4 ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -501,10 +486,10 @@ jobs: name: FreeBSD runs-on: ubuntu-latest steps: - - uses: actions/checkout at v5 + - uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -523,16 +508,14 @@ jobs: set -e export CCACHE_DIR=$PWD/.ccache cmake --version - cmake -S . -B _build -D USE_CCACHE=ON .. - cmake --build _build -j $(nproc) + cmake -S . -B build -D USE_CCACHE=ON + cmake --build build -j $(nproc) ccache --show-stats - cd _build - ctest --output-on-failure - cd .. - rm -rf _build + (cd build && ctest --output-on-failure) + rm -rf build - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -548,10 +531,10 @@ jobs: sudo -E apt-get autopurge -y needrestart sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make cmake emscripten ccache - - uses: actions/checkout at v5 + - uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -561,18 +544,16 @@ jobs: - name: Build run: | set -e - mkdir build - cd build cmake --version emcmake cmake \ -D BUILD_SHARED_LIBS=OFF \ -D USE_CCACHE=ON \ - .. - cmake --build . -j $(nproc) + -S . -B build + cmake --build build -j $(nproc) ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -592,8 +573,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install cppcheck python3 -m pip install --disable-pip-version-check --user codespell - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: 'cppcheck' run: ./tools/cppcheck.sh @@ -616,8 +596,7 @@ jobs: python3 -m pip install --disable-pip-version-check --user cmake==3.15.* echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 with: path: geos diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 556a2143e..46eb081ac 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -36,12 +36,11 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout at v4 + - uses: actions/checkout at v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init at v3 + uses: github/codeql-action/init at v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -64,6 +63,6 @@ jobs: make -j$(nproc) - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze at v3 + uses: github/codeql-action/analyze at v4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 0505fd9e1..07a0abb8c 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -22,14 +22,13 @@ jobs: steps: - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v2 + uses: docker/setup-buildx-action at v4 - name: Login to GitHub Container Registry - uses: docker/login-action at v2 + uses: docker/login-action at v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -40,7 +39,7 @@ jobs: cp tools/ci/geosop/Dockerfile . - name: Build and Push - uses: docker/build-push-action at v4 + uses: docker/build-push-action at v7 with: context: . # platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cd89dd4e..2edbafad7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,8 +32,7 @@ jobs: uname -a sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - - name: 'Check Out' - uses: actions/checkout at v4 + - uses: actions/checkout at v6 - name: Get tag id: tag @@ -68,7 +67,7 @@ jobs: - name: Create Release if: ${{ steps.tag.outputs.tag == steps.version.outputs.geosversion }} id: create_release - uses: softprops/action-gh-release at v1 + uses: softprops/action-gh-release at v2 with: body_path: ${{ steps.notes.outputs.geosnotes }} name: Release ${{ steps.version.outputs.geosversion }} diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 7a14b534c..c059e4210 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -27,7 +27,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out ?' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Hugo Build ?' # ...or replace 'master' with a full version tag, such as: v0.64.1 @@ -51,7 +51,7 @@ jobs: cp -ra build.cmake/doxygen/doxygen_docs/html/* public_html/doxygen - name: 'Deploy ?' - uses: JamesIves/github-pages-deploy-action at v4.4.1 + uses: JamesIves/github-pages-deploy-action at v4 with: branch: gh-pages # The branch the action should deploy to. folder: public_html # The folder the action should deploy. ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 101 ++++++++++++++++------------------------ .github/workflows/codeql.yml | 7 ++- .github/workflows/container.yml | 9 ++-- .github/workflows/release.yml | 5 +- .github/workflows/web.yml | 4 +- 5 files changed, 51 insertions(+), 75 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 11 04:48:22 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 11 Mar 2026 04:48:22 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 78c951c95dad8b6ff46b6f0d8b194ea93d3ad261 Message-ID: <20260311114823.26F7618AF5C@trac.osgeo.org> 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 78c951c95dad8b6ff46b6f0d8b194ea93d3ad261 (commit) from 701457b424a834b7da398d6abb60c642addce642 (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 78c951c95dad8b6ff46b6f0d8b194ea93d3ad261 Author: Sandro Santilli Date: Wed Mar 11 12:47:50 2026 +0100 Ignore files created by cmake diff --git a/.gitignore b/.gitignore index e57c23631..9d8abedec 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,28 @@ capi/geos_c.h .ccache/ web/public/ *.code-workspace +CPackConfig.cmake +CPackSourceConfig.cmake +CTestTestfile.cmake +capi/cmake_install.cmake +cmake/cmake_uninstall.cmake +doxygen/CTestTestfile.cmake +doxygen/cmake_install.cmake +geos-config-version.cmake +geos-config.cmake +geos-targets.cmake +include/cmake_install.cmake +src/cmake_install.cmake +src/deps/cmake_install.cmake +tests/CTestTestfile.cmake +tests/cmake_install.cmake +tests/unit/CTestTestfile.cmake +tests/unit/cmake_install.cmake +tests/xmltester/CTestTestfile.cmake +tests/xmltester/cmake_install.cmake +tools/CTestTestfile.cmake +tools/cmake_install.cmake +util/CTestTestfile.cmake +util/cmake_install.cmake +util/geosop/CTestTestfile.cmake +util/geosop/cmake_install.cmake ----------------------------------------------------------------------- Summary of changes: .gitignore | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 11 07:38:01 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 11 Mar 2026 07:38:01 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. d5977ebb4e29d6d970a3f784836a46796526f1fa Message-ID: <20260311143801.AA87018B34E@trac.osgeo.org> 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 d5977ebb4e29d6d970a3f784836a46796526f1fa (commit) from 78c951c95dad8b6ff46b6f0d8b194ea93d3ad261 (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 d5977ebb4e29d6d970a3f784836a46796526f1fa Author: Daniel Baston Date: Wed Mar 11 10:37:39 2026 -0400 Curved types: support getBoundary (#1394) diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 21a85501f..12d30c9f4 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -4733,6 +4733,8 @@ extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g); * * Z and M values in the input coordinates are preserved. * +* Curved geometry types are supported as of GEOS 3.15. +* * \param g The input geometry * \return A newly allocated geometry of the boundary. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). diff --git a/include/geos/geom/CompoundCurve.h b/include/geos/geom/CompoundCurve.h index 211a4aaa4..c685be18c 100644 --- a/include/geos/geom/CompoundCurve.h +++ b/include/geos/geom/CompoundCurve.h @@ -56,6 +56,8 @@ public: /// Returns the nth section of the CompoundCurve const SimpleCurve* getCurveN(std::size_t) const override; + std::unique_ptr getEndPoint() const override; + const Envelope* getEnvelopeInternal() const override { return &envelope; @@ -72,6 +74,8 @@ public: std::size_t getNumPoints() const override; + std::unique_ptr getStartPoint() const override; + bool hasCurvedComponents() const override; bool hasM() const override; diff --git a/include/geos/geom/Curve.h b/include/geos/geom/Curve.h index 352dff661..d07a9d375 100644 --- a/include/geos/geom/Curve.h +++ b/include/geos/geom/Curve.h @@ -52,6 +52,18 @@ public: return Dimension::L; // line } + /// \brief + /// Return the end point of the Curve + /// or NULL if this is an EMPTY Curve. + /// + virtual std::unique_ptr getEndPoint() const = 0; + + /// \brief + /// Return the start point of the Curve + /// or NULL if this is an EMPTY Curve. + /// + virtual std::unique_ptr getStartPoint() const = 0; + /// Returns true if the first and last coordinate in the Curve are the same virtual bool isClosed() const = 0; diff --git a/include/geos/geom/SimpleCurve.h b/include/geos/geom/SimpleCurve.h index acfc8fc7e..9d0538058 100644 --- a/include/geos/geom/SimpleCurve.h +++ b/include/geos/geom/SimpleCurve.h @@ -70,7 +70,7 @@ public: /// Return the end point of the LineString /// or NULL if this is an EMPTY LineString. /// - virtual std::unique_ptr getEndPoint() const; + std::unique_ptr getEndPoint() const override; const Envelope* getEnvelopeInternal() const override { @@ -87,7 +87,7 @@ public: /// Return the start point of the LineString /// or NULL if this is an EMPTY LineString. /// - virtual std::unique_ptr getStartPoint() const; + std::unique_ptr getStartPoint() const override; bool hasM() const override; diff --git a/include/geos/operation/BoundaryOp.h b/include/geos/operation/BoundaryOp.h index 4a5902763..7b204f030 100644 --- a/include/geos/operation/BoundaryOp.h +++ b/include/geos/operation/BoundaryOp.h @@ -24,8 +24,11 @@ namespace geos { namespace geom { +class Curve; class LineString; +class MultiCurve; class MultiLineString; +class GeometryCollection; } } @@ -108,11 +111,11 @@ private: const geom::GeometryFactory& m_geomFact; const algorithm::BoundaryNodeRule& m_bnRule; - std::unique_ptr boundaryMultiLineString(const geom::MultiLineString& mLine); + std::unique_ptr boundaryMultiCurve(const geom::GeometryCollection& mLine); - std::unique_ptr computeBoundaryCoordinates(const geom::MultiLineString& mLine); + std::unique_ptr computeBoundaryCoordinates(const geom::GeometryCollection& mLine) const; - std::unique_ptr boundaryLineString(const geom::LineString& line); + std::unique_ptr boundaryCurve(const geom::Curve& line) const; }; } diff --git a/src/geom/CompoundCurve.cpp b/src/geom/CompoundCurve.cpp index 9c01111b6..8897109c3 100644 --- a/src/geom/CompoundCurve.cpp +++ b/src/geom/CompoundCurve.cpp @@ -202,6 +202,18 @@ CompoundCurve::getCurveN(std::size_t i) const return curves[i].get(); } +std::unique_ptr +CompoundCurve::getEndPoint() const +{ + for (std::size_t i = curves.size(); i != 0; i--) { + if (!curves[i-1]->isEmpty()) { + return curves[i-1]->getEndPoint(); + } + } + + return nullptr; +} + std::string CompoundCurve::getGeometryType() const { @@ -240,6 +252,18 @@ CompoundCurve::getNumPoints() const return n; } +std::unique_ptr +CompoundCurve::getStartPoint() const +{ + for (const auto& curve : curves) { + if (!curve->isEmpty()) { + return curve->getStartPoint(); + } + } + + return nullptr; +} + bool CompoundCurve::hasZ() const { diff --git a/src/geom/CurvePolygon.cpp b/src/geom/CurvePolygon.cpp index c5213602c..7c181a13a 100644 --- a/src/geom/CurvePolygon.cpp +++ b/src/geom/CurvePolygon.cpp @@ -16,6 +16,10 @@ #include #include #include +#include +#include +#include +#include #include namespace geos { @@ -43,9 +47,37 @@ namespace geom { return GEOS_CURVEPOLYGON; } + static std::unique_ptr + getRingForBoundary(const Geometry* ring) + { + // Convert LinearRing -> LineString + if (ring->getGeometryTypeId() == GEOS_LINEARRING) { + return ring->getFactory()->createLineString(*static_cast(ring)); + } + return ring->clone(); + } + std::unique_ptr CurvePolygon::getBoundary() const { - throw util::UnsupportedOperationException(); + + const GeometryFactory* gf = getFactory(); + + if(isEmpty()) { + return gf->createMultiCurve(); + } + + if(holes.empty()) { + return getRingForBoundary(shell.get()); + } + + std::vector> rings(holes.size() + 1); + + rings[0] = getRingForBoundary(shell.get()); + for(std::size_t i = 0; i < holes.size(); ++i) { + rings[i + 1] = getRingForBoundary(holes[i].get()); + } + + return getFactory()->createMultiCurve(std::move(rings)); } void diff --git a/src/operation/BoundaryOp.cpp b/src/operation/BoundaryOp.cpp index c0c452c45..1cc02ff80 100644 --- a/src/operation/BoundaryOp.cpp +++ b/src/operation/BoundaryOp.cpp @@ -20,16 +20,22 @@ #include #include #include +#include +#include #include +#include #include +#include #include #include using geos::geom::Coordinate; using geos::geom::CoordinateSequence; +using geos::geom::Curve; using geos::geom::Dimension; using geos::geom::Geometry; using geos::geom::LineString; +using geos::geom::MultiCurve; using geos::geom::MultiLineString; using geos::geom::Point; using geos::algorithm::BoundaryNodeRule; @@ -52,14 +58,16 @@ BoundaryOp::BoundaryOp(const geom::Geometry& geom, const algorithm::BoundaryNode std::unique_ptr BoundaryOp::getBoundary() { - util::ensureNoCurvedComponents(m_geom); - - if (auto ls = dynamic_cast(&m_geom)) { - return boundaryLineString(*ls); + if (auto ls = dynamic_cast(&m_geom)) { + return boundaryCurve(*ls); } if (auto mls = dynamic_cast(&m_geom)) { - return boundaryMultiLineString(*mls); + return boundaryMultiCurve(*mls); + } + + if (auto mc = dynamic_cast(&m_geom)) { + return boundaryMultiCurve(*mc); } return m_geom.getBoundary(); @@ -104,7 +112,7 @@ BoundaryOp::hasBoundary(const geom::Geometry& geom, const algorithm::BoundaryNod } std::unique_ptr -BoundaryOp::boundaryLineString(const geom::LineString& line) +BoundaryOp::boundaryCurve(const geom::Curve& line) const { if (m_geom.isEmpty()) { return m_geomFact.createMultiPoint(); @@ -112,7 +120,7 @@ BoundaryOp::boundaryLineString(const geom::LineString& line) if (line.isClosed()) { // check whether endpoints of valence 2 are on the boundary or not - bool closedEndpointOnBoundary = m_bnRule.isInBoundary(2); + const bool closedEndpointOnBoundary = m_bnRule.isInBoundary(2); if (closedEndpointOnBoundary) { return line.getStartPoint(); } @@ -129,7 +137,7 @@ BoundaryOp::boundaryLineString(const geom::LineString& line) } std::unique_ptr -BoundaryOp::boundaryMultiLineString(const geom::MultiLineString& mLine) +BoundaryOp::boundaryMultiCurve(const geom::GeometryCollection& mLine) { if (m_geom.isEmpty()) { return m_geomFact.createMultiPoint(); @@ -143,29 +151,68 @@ BoundaryOp::boundaryMultiLineString(const geom::MultiLineString& mLine) return m_geomFact.createPoint(c); }); } + // this handles 0 points case as well return std::unique_ptr(m_geomFact.createMultiPoint(*bdyPts)); } -std::unique_ptr -BoundaryOp::computeBoundaryCoordinates(const geom::MultiLineString& mLine) +static const CoordinateSequence* +getFirstSequence(const Curve& curve) { + if (curve.getGeometryTypeId() == geom::GEOS_COMPOUNDCURVE) { + const auto& cc = static_cast(curve); + for (std::size_t i = 0; i < cc.getNumCurves(); i++) { + if (!cc.getCurveN(i)->isEmpty()) { + return cc.getCurveN(i)->getCoordinatesRO(); + } + } + + return nullptr; + } + + return static_cast(curve).getCoordinatesRO(); +} + +static const CoordinateSequence* +getLastSequence(const Curve& curve) +{ + if (curve.getGeometryTypeId() == geom::GEOS_COMPOUNDCURVE) { + const auto& cc = static_cast(curve); + for (std::size_t i = cc.getNumCurves(); i != 0; i--) { + if (!cc.getCurveN(i-1)->isEmpty()) { + return cc.getCurveN(i-1)->getCoordinatesRO(); + } + } + + return nullptr; + } + + return static_cast(curve).getCoordinatesRO(); +} + +std::unique_ptr +BoundaryOp::computeBoundaryCoordinates(const geom::GeometryCollection& mLine) const +{ + assert(mLine.getGeometryTypeId() == geom::GEOS_MULTILINESTRING || mLine.getGeometryTypeId() == geom::GEOS_MULTICURVE); + auto bdyPts = detail::make_unique(0, mLine.hasZ(), mLine.hasM()); std::map endpointMap; for (std::size_t i = 0; i < mLine.getNumGeometries(); i++) { - const LineString* line = mLine.getGeometryN(i); + const Curve* line = detail::down_cast(mLine.getGeometryN(i)); if (line->getNumPoints() == 0) { continue; } - const CoordinateSequence& pts = *line->getCoordinatesRO(); - geom::CoordinateXYZM start; geom::CoordinateXYZM end; - pts.getAt(0, start); - pts.getAt(pts.size() - 1, end); + + const geom::CoordinateSequence* firstPts = getFirstSequence(*line); + const geom::CoordinateSequence* lastPts = getLastSequence(*line); + + firstPts->getAt(0, start); + lastPts->getAt(lastPts->size() - 1, end); endpointMap[start]++; endpointMap[end]++; diff --git a/tests/unit/capi/GEOSBoundaryTest.cpp b/tests/unit/capi/GEOSBoundaryTest.cpp index 17f4af46e..ce36d6e40 100644 --- a/tests/unit/capi/GEOSBoundaryTest.cpp +++ b/tests/unit/capi/GEOSBoundaryTest.cpp @@ -34,11 +34,16 @@ template<> template<> void object::test<2>() { + set_test_name("curved inputs"); + input_ = fromWKT("CIRCULARSTRING (0 0, 1 1, 2 0)"); ensure(input_ != nullptr); result_ = GEOSBoundary(input_); - ensure(result_ == nullptr); + ensure(result_); + + expected_ = fromWKT("MULTIPOINT (0 0, 2 0)"); + ensure_geometry_equals_identical(result_, expected_); } template<> diff --git a/tests/unit/geom/CircularStringTest.cpp b/tests/unit/geom/CircularStringTest.cpp index 045c61739..8204468c8 100644 --- a/tests/unit/geom/CircularStringTest.cpp +++ b/tests/unit/geom/CircularStringTest.cpp @@ -148,9 +148,10 @@ void object::test<3>() ensure_THROW(cs_->getCentroid(), geos::util::UnsupportedOperationException); - //auto expected_boundary = wktreader_.read("MULTIPOINT ((0 0), (1 1), (2 0), (3 -1), (4 0))"); - //ensure("getBoundary", cs_->getBoundary()->equalsIdentical(expected_boundary.get())); - ensure_THROW(cs_->getBoundary(), geos::util::UnsupportedOperationException); + { + auto expected_boundary = wktreader_.read("MULTIPOINT ((0 0), (4 0))"); + ensure("getBoundary", cs_->getBoundary()->equalsIdentical(expected_boundary.get())); + } ensure("clone", cs_->equalsIdentical(cs_->clone().get())); diff --git a/tests/unit/geom/CompoundCurveTest.cpp b/tests/unit/geom/CompoundCurveTest.cpp index 165c67338..499fd3699 100644 --- a/tests/unit/geom/CompoundCurveTest.cpp +++ b/tests/unit/geom/CompoundCurveTest.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,8 @@ template<> template<> void object::test<1>() { + set_test_name("empty CompoundCurve"); + auto cc = factory_->createCompoundCurve(); ensure("isEmpty", cc->isEmpty()); @@ -68,6 +71,9 @@ void object::test<1>() ensure_equals("getArea", cc->getArea(), 0); ensure_equals("getLength", cc->getLength(), 0); + + ensure("getStartPoint", cc->getStartPoint() == nullptr); + ensure("getEndPoint", cc->getEndPoint() == nullptr); } // Basic Geometry API @@ -77,7 +83,7 @@ void object::test<2>() { // Geometry type functions ensure_equals("getGeometryType", cc_->getGeometryType(), "CompoundCurve"); - ensure_equals("getGeometryTypdId", cc_->getGeometryTypeId(), geos::geom::GEOS_COMPOUNDCURVE); + ensure_equals("getGeometryTypeId", cc_->getGeometryTypeId(), geos::geom::GEOS_COMPOUNDCURVE); ensure("isCollection", !cc_->isCollection()); // Geometry size functions @@ -110,6 +116,11 @@ void object::test<2>() // Coordinate access functions ensure("getCoordinates", cc_->getCoordinates()->getSize() == 5u); ensure_equals("getCoordinate", *cc_->getCoordinate(), CoordinateXY(0, 0)); + ensure_equals_geometry(static_cast(cc_->getStartPoint().get()), wktreader_.read("POINT (0 0)").get()); + ensure_equals_geometry(static_cast(cc_->getEndPoint().get()), wktreader_.read("POINT (2 2)").get()); + + ensure_equals_geometry(cc_->getStartPoint().get(), factory_->createPoint(CoordinateXY{0, 0}).get()); + ensure_equals_geometry(cc_->getEndPoint().get(), factory_->createPoint(CoordinateXY{2, 2}).get()); } // Operations @@ -154,7 +165,15 @@ void object::test<3>() ensure_THROW(cc_->convexHull(), geos::util::UnsupportedOperationException); ensure_THROW(cc_->buffer(1), geos::util::UnsupportedOperationException); ensure_THROW(cc_->getCentroid(), geos::util::UnsupportedOperationException); - ensure_THROW(cc_->getBoundary(), geos::util::UnsupportedOperationException); + + { + CoordinateSequence seq(2, false, false); + seq.setAt(CoordinateXY{0, 0}, 0); + seq.setAt(CoordinateXY{2, 2}, 1); + std::unique_ptr mp = factory_->createMultiPoint(seq); + + ensure_equals_geometry(cc_->getBoundary().get(), mp.get()); + } ensure("clone", cc_->equalsIdentical(cc_->clone().get())); diff --git a/tests/unit/geom/CurvePolygonTest.cpp b/tests/unit/geom/CurvePolygonTest.cpp index ebddf3328..ff638685c 100644 --- a/tests/unit/geom/CurvePolygonTest.cpp +++ b/tests/unit/geom/CurvePolygonTest.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -8,6 +9,8 @@ #include #include +#include "utility.h" + using geos::geom::CoordinateXY; using geos::geom::CurvePolygon; @@ -64,6 +67,8 @@ template<> template<> void object::test<1>() { + set_test_name("empty CurvePolygon"); + auto cp = factory_->createCurvePolygon(false, false); ensure("isEmpty", cp->isEmpty()); @@ -77,6 +82,12 @@ void object::test<1>() ensure_equals("getArea", cp->getArea(), 0.0); ensure_equals("getLength", cp->getLength(), 0.0); + + { + auto boundary = cp->getBoundary(); + ensure(boundary->isEmpty()); + ensure_equals(boundary->getGeometryTypeId(), geos::geom::GeometryTypeId::GEOS_MULTICURVE); + } } // Basic Geometry API @@ -170,7 +181,11 @@ void object::test<3>() ensure_THROW(cp_->convexHull(), geos::util::UnsupportedOperationException); ensure_THROW(cp_->buffer(1), geos::util::UnsupportedOperationException); ensure_THROW(cp_->getCentroid(), geos::util::UnsupportedOperationException); - ensure_THROW(cp_->getBoundary(), geos::util::UnsupportedOperationException); + { + auto boundary = cp_->getBoundary(); + ensure_equals(boundary->getGeometryTypeId(), geos::geom::GEOS_MULTICURVE); + ensure_equals(cp_->getLength(), boundary->getLength()); + } ensure("clone", cp_->equalsIdentical(cp_->clone().get())); diff --git a/tests/unit/geom/MultiCurveTest.cpp b/tests/unit/geom/MultiCurveTest.cpp index 09c79fd12..1ca766cf1 100644 --- a/tests/unit/geom/MultiCurveTest.cpp +++ b/tests/unit/geom/MultiCurveTest.cpp @@ -8,6 +8,8 @@ #include #include +#include "utility.h" + using geos::geom::CoordinateXY; namespace tut { @@ -166,7 +168,10 @@ void object::test<3>() ensure_THROW(mc_->convexHull(), geos::util::UnsupportedOperationException); ensure_THROW(mc_->buffer(1), geos::util::UnsupportedOperationException); ensure_THROW(mc_->getCentroid(), geos::util::UnsupportedOperationException); - ensure_THROW(mc_->getBoundary(), geos::util::UnsupportedOperationException); + { + auto expected_boundary = wktreader_.read("MULTIPOINT ((8 9), (10 11))"); + ensure_equals_geometry(mc_->getBoundary().get(), expected_boundary.get()); + } ensure("clone", mc_->equalsIdentical(mc_->clone().get())); diff --git a/tests/unit/geom/MultiSurfaceTest.cpp b/tests/unit/geom/MultiSurfaceTest.cpp index 58c6ae524..9d422c961 100644 --- a/tests/unit/geom/MultiSurfaceTest.cpp +++ b/tests/unit/geom/MultiSurfaceTest.cpp @@ -9,6 +9,8 @@ #include #include +#include "utility.h" + using geos::geom::CoordinateXY; namespace tut { @@ -155,7 +157,10 @@ void object::test<3>() ensure_THROW(ms_->convexHull(), geos::util::UnsupportedOperationException); ensure_THROW(ms_->buffer(1), geos::util::UnsupportedOperationException); ensure_THROW(ms_->getCentroid(), geos::util::UnsupportedOperationException); - ensure_THROW(ms_->getBoundary(), geos::util::UnsupportedOperationException); + { + auto expected_boundary = wktreader_.read("MULTICURVE ((0 0, 1 0, 1 1, 0 1, 0 0), CIRCULARSTRING (10 10, 11 11, 12 10, 11 9, 10 10))"); + ensure_equals_exact_geometry(ms_->getBoundary().get(), expected_boundary.get(), 0); + } ensure("clone", ms_->equalsIdentical(ms_->clone().get())); diff --git a/tests/unit/operation/BoundaryOpTest.cpp b/tests/unit/operation/BoundaryOpTest.cpp index de392dbff..8ae1de80a 100644 --- a/tests/unit/operation/BoundaryOpTest.cpp +++ b/tests/unit/operation/BoundaryOpTest.cpp @@ -8,6 +8,8 @@ #include #include +#include "utility.h" + using namespace geos::algorithm; using namespace geos::geom; using geos::operation::BoundaryOp; @@ -28,7 +30,7 @@ struct test_boundaryop_data { BoundaryOp op(*g, bnRule); auto boundary = op.getBoundary(); - ensure(boundary->equals(expected.get())); + ensure_equals_geometry(boundary.get(), expected.get()); } void checkHasBoundary(const std::string& wkt) @@ -105,7 +107,7 @@ void object::test<3>() "POINT (10 10)" ); } -// testMultiLinestd::stringWithRingTouchAtEndpoint +// testMultiLineStringWithRingTouchAtEndpoint template<> template<> void object::test<4>() @@ -156,7 +158,7 @@ void object::test<8>() checkHasBoundary( "LINESTRING (100 100, 20 20, 200 20, 100 100)", false); } -// testHasBoundaryMultiLinestd::stringClosed +// testHasBoundaryMultiLineStringClosed template<> template<> void object::test<9>() @@ -164,7 +166,7 @@ void object::test<9>() checkHasBoundary( "MULTILINESTRING ((0 0, 0 1), (0 1, 1 1, 1 0, 0 0))", false); } -// testHasBoundaryMultiLinestd::stringOpen +// testHasBoundaryMultiLineStringOpen template<> template<> void object::test<10>() @@ -188,4 +190,102 @@ void object::test<12>() checkHasBoundary( "POLYGON EMPTY", false); } +template<> +template<> +void object::test<13>() +{ + set_test_name("closed CircularString has no boundary"); + + checkHasBoundary( "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)", false); +} + +template<> +template<> +void object::test<14>() +{ + set_test_name("non-closed CircularString has a boundary"); + + checkHasBoundary( "CIRCULARSTRING (-5 0, 0 5, 5 0)"); +} + +template<> +template<> +void object::test<15>() +{ + set_test_name("closed CompoundCurve has no boundary"); + + checkHasBoundary( "COMPOUNDCURVE (CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, -5 0))", false); +} + +template<> +template<> +void object::test<16>() +{ + set_test_name("non-closed CompoundCurve has a boundary"); + + checkHasBoundary( "COMPOUNDCURVE (CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, 0 0))"); +} + +template<> +template<> +void object::test<17>() +{ + set_test_name("closed MultiCurve has no boundary"); + + checkHasBoundary( "MULTICURVE ((-5 0, 5 0), CIRCULARSTRING (-5 0, 0 5, 5 0))", false); +} + + +template<> +template<> +void object::test<18>() +{ + set_test_name("non-closed MultiCurve has a boundary"); + + checkHasBoundary( "MULTICURVE ((0 0, 5 0), CIRCULARSTRING (-5 0, 0 5, 5 0))"); +} + +template<> +template<> +void object::test<19>() +{ + set_test_name("boundary of closed CircularString"); + + std::string a = "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)"; + // rings are simple under all rules + runBoundaryTest(a, BoundaryNodeRule::getBoundaryRuleMod2(), + "MULTIPOINT EMPTY"); + runBoundaryTest(a, BoundaryNodeRule::getBoundaryEndPoint(), + "POINT (-5 0)" ); +} + +template<> +template<> +void object::test<20>() +{ + set_test_name("boundary of closed CompoundCurve"); + + std::string a = "COMPOUNDCURVE(CIRCULARSTRING (-5 0, 0 5, 5 0), (5 0, -5 0))"; + // rings are simple under all rules + runBoundaryTest(a, BoundaryNodeRule::getBoundaryRuleMod2(), + "MULTIPOINT EMPTY"); + runBoundaryTest(a, BoundaryNodeRule::getBoundaryEndPoint(), + "POINT (-5 0)" ); +} + +template<> +template<> +void object::test<21>() +{ + set_test_name("boundary of MultiCurve"); + + std::string a = "MULTICURVE ((100 100, 20 20), CIRCULARSTRING (20 20, 110 0, 200 20), (200 20, 100 100), (100 200, 100 100))"; + // under Mod-2, the ring has no boundary, so the line intersects the interior ==> not simple + runBoundaryTest(a, BoundaryNodeRule::getBoundaryRuleMod2(), + "MULTIPOINT ((100 100), (100 200))" ); + // under Endpoint, the ring has a boundary point, so the line does NOT intersect the interior ==> simple + runBoundaryTest(a, BoundaryNodeRule::getBoundaryEndPoint(), + "MULTIPOINT ((100 100), (100 200), (20 20), (200 20))" ); +} + } diff --git a/tests/unit/utility.h b/tests/unit/utility.h index 0a15532ed..ba456c34c 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -534,11 +534,11 @@ ensure_equals_exact_geometry(const geos::geom::Geometry *lhs_in, assert(nullptr != lhs_in); assert(nullptr != rhs_in); - using geos::geom::Point; - using geos::geom::LineString; - using geos::geom::Polygon; using geos::geom::CoordinateSequence; using geos::geom::GeometryCollection; + using geos::geom::Point; + using geos::geom::Polygon; + using geos::geom::SimpleCurve; ensure_equals("type id do not match", lhs_in->getGeometryTypeId(), rhs_in->getGeometryTypeId()); @@ -547,8 +547,8 @@ ensure_equals_exact_geometry(const geos::geom::Geometry *lhs_in, const Point *gpt2 = static_cast(rhs_in); return ensure_equals_dims( gpt1->getCoordinatesRO(), gpt2->getCoordinatesRO(), 2, tolerance); } - else if (const LineString* gln1 = dynamic_cast(lhs_in)) { - const LineString *gln2 = static_cast(rhs_in); + else if (const SimpleCurve* gln1 = dynamic_cast(lhs_in)) { + const SimpleCurve *gln2 = static_cast(rhs_in); return ensure_equals_dims( gln1->getCoordinatesRO(), gln2->getCoordinatesRO(), 2, tolerance); } else if (const GeometryCollection* gc1 = dynamic_cast(lhs_in)) { ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 2 + include/geos/geom/CompoundCurve.h | 4 ++ include/geos/geom/Curve.h | 12 ++++ include/geos/geom/SimpleCurve.h | 4 +- include/geos/operation/BoundaryOp.h | 9 ++- src/geom/CompoundCurve.cpp | 24 +++++++ src/geom/CurvePolygon.cpp | 34 +++++++++- src/operation/BoundaryOp.cpp | 75 +++++++++++++++++----- tests/unit/capi/GEOSBoundaryTest.cpp | 7 ++- tests/unit/geom/CircularStringTest.cpp | 7 ++- tests/unit/geom/CompoundCurveTest.cpp | 23 ++++++- tests/unit/geom/CurvePolygonTest.cpp | 17 ++++- tests/unit/geom/MultiCurveTest.cpp | 7 ++- tests/unit/geom/MultiSurfaceTest.cpp | 7 ++- tests/unit/operation/BoundaryOpTest.cpp | 108 ++++++++++++++++++++++++++++++-- tests/unit/utility.h | 10 +-- 16 files changed, 312 insertions(+), 38 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 11 08:41:33 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 11 Mar 2026 08:41:33 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 62b3524601c63abb662ee7c8cae428c24fe92af0 Message-ID: <20260311154134.8EB7618B36F@trac.osgeo.org> 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 62b3524601c63abb662ee7c8cae428c24fe92af0 (commit) via 8abf06184f336f7c5524445a060412d556bb1b36 (commit) via c7f42e65c04579decfeb87af05acf6f4b3c3fdfc (commit) via 5811106e467c051e4f616d686dc96a372d637c57 (commit) via c89ef8e0f371ca82387f821b011c64a02012cba4 (commit) via 377631cf28007b1d59649b9cb6dcd8bf23083fcc (commit) from d5977ebb4e29d6d970a3f784836a46796526f1fa (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 62b3524601c63abb662ee7c8cae428c24fe92af0 Author: Daniel Baston Date: Tue Mar 10 14:08:45 2026 -0400 LineString: Simplify implementation of normalize() Since the addition of normalizeClosed() in a807833875976a29fbcf509297f4a7a5f837aa09, we are guaranteed that the first and last points differ. The need for normalization can therefore be determined without looping over the points. diff --git a/src/geom/LineString.cpp b/src/geom/LineString.cpp index b3f1ceb26..c05932754 100644 --- a/src/geom/LineString.cpp +++ b/src/geom/LineString.cpp @@ -131,19 +131,12 @@ LineString::normalize() normalizeClosed(); return; } - std::size_t npts = points->getSize(); - std::size_t n = npts / 2; - for (std::size_t i = 0; i < n; i++) { - std::size_t j = npts - 1 - i; - if (!(points->getAt(i) == points->getAt(j))) { - if (points->getAt(i).compareTo(points->getAt(j)) > 0) { - if (points.use_count() > 1) { - points = points->clone(); - } - const_cast(points.get())->reverse(); - } - return; + + if (points->front().compareTo( points->back()) == 1) { + if (points.use_count() > 1) { + points = points->clone(); } + const_cast(points.get())->reverse(); } } commit 8abf06184f336f7c5524445a060412d556bb1b36 Author: Daniel Baston Date: Tue Mar 10 13:29:05 2026 -0400 CurvePolygon: Support normalize() diff --git a/include/geos/geom/Curve.h b/include/geos/geom/Curve.h index d07a9d375..f9968fb9e 100644 --- a/include/geos/geom/Curve.h +++ b/include/geos/geom/Curve.h @@ -74,6 +74,8 @@ public: virtual const SimpleCurve* getCurveN(std::size_t) const = 0; + std::unique_ptr reverse() const; + protected: Curve(const GeometryFactory& factory) : Geometry(&factory) {} diff --git a/src/geom/Curve.cpp b/src/geom/Curve.cpp index 91fd60da2..a55678267 100644 --- a/src/geom/Curve.cpp +++ b/src/geom/Curve.cpp @@ -54,6 +54,12 @@ Curve::isRing() const return isClosed() && isSimple(); } +std::unique_ptr +Curve::reverse() const +{ + return std::unique_ptr(static_cast(Geometry::reverse().release())); +} + } } diff --git a/src/geom/CurvePolygon.cpp b/src/geom/CurvePolygon.cpp index 7c181a13a..7f07e9f41 100644 --- a/src/geom/CurvePolygon.cpp +++ b/src/geom/CurvePolygon.cpp @@ -81,8 +81,16 @@ namespace geom { } void - CurvePolygon::normalize() { - throw util::UnsupportedOperationException(); + CurvePolygon::normalize() + { + shell->normalize(); + for(auto& lr : holes) { + lr->normalize(); + lr = lr->reverse(); + } + std::sort(holes.begin(), holes.end(), [](const auto& a, const auto& b) { + return a->compareTo(b.get()) > 0; + }); } double CurvePolygon::getArea() const { diff --git a/tests/unit/geom/CurvePolygonTest.cpp b/tests/unit/geom/CurvePolygonTest.cpp index ff638685c..0e60aded8 100644 --- a/tests/unit/geom/CurvePolygonTest.cpp +++ b/tests/unit/geom/CurvePolygonTest.cpp @@ -144,6 +144,8 @@ template<> template<> void object::test<3>() { + set_test_name("operations"); + // Predicates ensure_THROW(cp_->contains(cp_.get()), geos::util::UnsupportedOperationException); ensure_THROW(cp_->coveredBy(cp_.get()), geos::util::UnsupportedOperationException); @@ -196,7 +198,6 @@ void object::test<3>() "COMPOUNDCURVE ((0 0, 1 4, 4 5, 4 3), CIRCULARSTRING (4 3, 2 3, 2 1, 2 0, 0 0)), " "CIRCULARSTRING (1.7 1, 1.6 0.5, 1.6 0.4, 1.4 0.4, 1.7 1))").get())); auto cc3 = cp_->reverse(); - ensure_THROW(cc3->normalize(), geos::util::UnsupportedOperationException); } template<> @@ -245,9 +246,36 @@ void object::test<5>() std::vector> holes; holes.push_back(std::move(cc)); - // hole is non-cloesd + // hole is non-closed ensure_THROW(factory_->createCurvePolygon(std::move(shell), std::move(holes)), geos::util::IllegalArgumentException); } +template<> +template<> +void object::test<6>() +{ + set_test_name("normalize"); + + auto input = wktreader_.read( + "CURVEPOLYGON (" + "COMPOUNDCURVE ((10 10, 10 0, 0 0, 0 10), CIRCULARSTRING (0 10, 5 15, 10 10))," + "(6 5, 6 6, 5 6, 5 5, 6 5)," + "CIRCULARSTRING (7 7, 8 8, 9 7, 8 6, 7 7)," + "CIRCULARSTRING (5 3, 4 2, 3 3, 4 4, 5 3))"); + + // ordering of holes is not strictly spatial, because we first sort on + // geometry type + auto expected = wktreader_.read( + "CURVEPOLYGON (" + "COMPOUNDCURVE ((0 0, 0 10), CIRCULARSTRING (0 10, 5 15, 10 10), (10 10, 10 0, 0 0)), " + "CIRCULARSTRING (7 7, 8 6, 9 7, 8 8, 7 7), " + "CIRCULARSTRING (3 3, 4 2, 5 3, 4 4, 3 3), " + "(5 5, 6 5, 6 6, 5 6, 5 5))"); + + auto result = input->clone(); + result->normalize(); + + ensure_equals_exact_geometry_xyzm(result.get(), expected.get(), 0); +} } diff --git a/tests/unit/geom/MultiSurfaceTest.cpp b/tests/unit/geom/MultiSurfaceTest.cpp index 9d422c961..1b1d3509a 100644 --- a/tests/unit/geom/MultiSurfaceTest.cpp +++ b/tests/unit/geom/MultiSurfaceTest.cpp @@ -120,6 +120,8 @@ template<> template<> void object::test<3>() { + set_test_name("operations"); + // Predicates ensure_THROW(ms_->contains(ms_.get()), geos::util::UnsupportedOperationException); ensure_THROW(ms_->coveredBy(ms_.get()), geos::util::UnsupportedOperationException); @@ -170,7 +172,6 @@ void object::test<3>() "MULTISURFACE (((0 0, 0 1, 1 1, 1 0, 0 0)), " "CURVEPOLYGON (CIRCULARSTRING (10 10, 11 9, 12 10, 11 11, 10 10)))").get())); auto cc3 = ms_->reverse(); - ensure_THROW(cc3->normalize(), geos::util::UnsupportedOperationException); } } commit c7f42e65c04579decfeb87af05acf6f4b3c3fdfc Author: Daniel Baston Date: Tue Mar 10 13:27:41 2026 -0400 CircularString: fix incorrect sort index diff --git a/include/geos/geom/CircularString.h b/include/geos/geom/CircularString.h index 54089f3bc..a2f0e5afb 100644 --- a/include/geos/geom/CircularString.h +++ b/include/geos/geom/CircularString.h @@ -79,7 +79,7 @@ protected: int getSortIndex() const override { - return SORTINDEX_LINESTRING; + return SORTINDEX_CIRCULARSTRING; }; CircularString* reverseImpl() const override; commit 5811106e467c051e4f616d686dc96a372d637c57 Author: Daniel Baston Date: Tue Mar 10 12:03:32 2026 -0400 CompoundCurve: Support normalize() diff --git a/include/geos/geom/CompoundCurve.h b/include/geos/geom/CompoundCurve.h index c685be18c..ae22670e8 100644 --- a/include/geos/geom/CompoundCurve.h +++ b/include/geos/geom/CompoundCurve.h @@ -119,6 +119,10 @@ protected: CompoundCurve* reverseImpl() const override; private: + void normalizeClosed(); + + void reverseInPlace(); + std::vector> curves; Envelope envelope; }; diff --git a/include/geos/geom/SimpleCurve.h b/include/geos/geom/SimpleCurve.h index 2c7e4c8f4..6fe96b40c 100644 --- a/include/geos/geom/SimpleCurve.h +++ b/include/geos/geom/SimpleCurve.h @@ -101,6 +101,8 @@ public: bool isEmpty() const override; + std::unique_ptr reverse() const; + protected: SimpleCurve(const SimpleCurve& other); diff --git a/include/geos/operation/split/SplitGeometryAtVertex.h b/include/geos/operation/split/SplitGeometryAtVertex.h new file mode 100644 index 000000000..cfee8f817 --- /dev/null +++ b/include/geos/operation/split/SplitGeometryAtVertex.h @@ -0,0 +1,43 @@ +/********************************************************************** +* + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 ISciences, LLC + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#pragma once + +#include +#include +#include + +// Forward declarations +namespace geos::geom { +class CircularString; +class LineString; +class SimpleCurve; +} + +namespace geos::operation::split { + +class GEOS_DLL SplitGeometryAtVertex { + +public: + static std::pair, std::unique_ptr> + splitSimpleCurveAtVertex(const geom::SimpleCurve& sc, std::size_t i); + + static std::pair, std::unique_ptr> + splitLineStringAtVertex(const geom::LineString& ls, std::size_t i); + + static std::pair, std::unique_ptr> + splitCircularStringAtVertex(const geom::CircularString& cs, std::size_t i); +}; + +} diff --git a/src/geom/CompoundCurve.cpp b/src/geom/CompoundCurve.cpp index 8897109c3..d2e268f9b 100644 --- a/src/geom/CompoundCurve.cpp +++ b/src/geom/CompoundCurve.cpp @@ -3,7 +3,7 @@ * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * - * Copyright (C) 2024 ISciences, LLC + * Copyright (C) 2024-2026 ISciences, LLC * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published @@ -14,10 +14,13 @@ #include +#include #include #include +#include #include #include +#include #include namespace geos { @@ -315,7 +318,83 @@ CompoundCurve::isEmpty() const void CompoundCurve::normalize() { - throw util::UnsupportedOperationException(); + if (isEmpty()) { + return; + } + + if (isClosed()) { + normalizeClosed(); + return; + } + + const CoordinateXY& firstPt = curves.front()->getCoordinatesRO()->front(); + const CoordinateXY& lastPt = curves.back()->getCoordinatesRO()->back(); + + if (firstPt.compareTo(lastPt) > 0) { + reverseInPlace(); + } +} + + +void +CompoundCurve::normalizeClosed() +{ + std::size_t minCurve = 0; + std::size_t minInd = 0; + const CoordinateXY* minPt = nullptr; + + auto orientationPoints = getCoordinates(); + + // TODO: Avoid copying all coordinates here. + // Would require updating Orientation::isCCW to take an iterator + if (orientationPoints->size() >= 4 && algorithm::Orientation::isCCW(orientationPoints.get())) { + reverseInPlace(); + } + + for (std::size_t iCurve = 0; iCurve < curves.size(); iCurve++) { + const CoordinateSequence* curvePts = curves[iCurve]->getCoordinatesRO(); + + auto nPts = curvePts == nullptr ? 0 : curvePts->size(); + + std::size_t step = curves[iCurve]->getGeometryTypeId() == GEOS_CIRCULARSTRING ? 2 : 1; + + for (std::size_t i = 0 ; i < nPts; i += step) { + const CoordinateXY* pt = &curvePts->getAt(i); + if (minPt == nullptr || pt->compareTo(*minPt) < 0) { + minPt = pt; + minCurve = iCurve; + minInd = i; + } + } + } + + if (minCurve == 0 && minInd == 0) { + return; + } + + std::vector> newCurves; + std::unique_ptr finalCurve; + if (minInd == 0) { + newCurves.push_back(std::move(curves[minCurve])); + } else if (minInd == curves[minCurve]->getNumPoints() - 1) { + finalCurve = std::move(curves[minCurve]); + } else { + auto split = operation::split::SplitGeometryAtVertex::splitSimpleCurveAtVertex(*curves[minCurve], minInd); + newCurves.push_back(std::move(split.second)); + finalCurve = std::move(split.first); + } + + for (std::size_t i = minCurve + 1; i < curves.size(); i++) { + newCurves.push_back(std::move(curves[i])); + } + for (std::size_t i = 0; i < minCurve; i++) { + newCurves.push_back(std::move(curves[i])); + } + if (finalCurve) { + newCurves.push_back(std::move(finalCurve)); + } + + curves = std::move(newCurves); } std::unique_ptr @@ -335,6 +414,16 @@ CompoundCurve::reverseImpl() const return getFactory()->createCompoundCurve(std::move(reversed)).release(); } +void +CompoundCurve::reverseInPlace() +{ + std::reverse(curves.begin(), curves.end()); + for (auto& curve: curves) { + curve = curve->reverse(); + } +} + + void CompoundCurve::validateConstruction() const { diff --git a/src/geom/SimpleCurve.cpp b/src/geom/SimpleCurve.cpp index e882f8fdf..40fbf460b 100644 --- a/src/geom/SimpleCurve.cpp +++ b/src/geom/SimpleCurve.cpp @@ -330,5 +330,11 @@ SimpleCurve::isEmpty() const return points->isEmpty(); } +std::unique_ptr +SimpleCurve::reverse() const +{ + return std::unique_ptr(static_cast(reverseImpl())); +} + } // namespace geos::geom } // namespace geos diff --git a/src/operation/split/SplitGeometryAtVertex.cpp b/src/operation/split/SplitGeometryAtVertex.cpp new file mode 100644 index 000000000..eba4beeef --- /dev/null +++ b/src/operation/split/SplitGeometryAtVertex.cpp @@ -0,0 +1,84 @@ +/********************************************************************** +* + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 ISciences, LLC + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include + +#include +#include +#include +#include + +using geos::geom::CoordinateSequence; +using geos::geom::CircularString; +using geos::geom::LineString; +using geos::geom::SimpleCurve; +using geos::geom::GeometryTypeId; + +namespace geos::operation::split { +std::pair, std::unique_ptr> + SplitGeometryAtVertex::splitLineStringAtVertex(const LineString& ls, std::size_t i) +{ + const auto& gf = *ls.getFactory(); + const CoordinateSequence& pts = *ls.getCoordinatesRO(); + + auto pts1 = std::make_shared(0, pts.hasZ(), pts.hasM()); + auto pts2 = std::make_shared(0, pts.hasZ(), pts.hasM()); + + if (i > 0) { + pts1->add(pts, 0, i); + } + if (i < pts.size() - 1) { + pts2->add(pts, i, pts.size() - 1); + } + + return { gf.createLineString(pts1), gf.createLineString(pts2) }; +} + +std::pair, std::unique_ptr> + SplitGeometryAtVertex::splitCircularStringAtVertex(const CircularString& cs, std::size_t i) +{ + const auto& gf = *cs.getFactory(); + const CoordinateSequence& pts = *cs.getCoordinatesRO(); + + if (i % 2) { + throw util::IllegalArgumentException("Cannot split CircularString at arc control point"); + } + + auto pts1 = std::make_shared(0, pts.hasZ(), pts.hasM()); + auto pts2 = std::make_shared(0, pts.hasZ(), pts.hasM()); + + if (i > 0) { + pts1->add(pts, 0, i); + } + if (i < pts.size() - 1) { + pts2->add(pts, i, pts.size() - 1); + } + + return { gf.createCircularString(pts1), gf.createCircularString(pts2) }; +} + +std::pair, std::unique_ptr> + SplitGeometryAtVertex::splitSimpleCurveAtVertex(const SimpleCurve& sc, std::size_t i) +{ + if (sc.getGeometryTypeId() == GeometryTypeId::GEOS_CIRCULARSTRING) { + return splitCircularStringAtVertex(static_cast(sc), i); + } + if (sc.getGeometryTypeId() == GeometryTypeId::GEOS_LINESTRING || sc.getGeometryTypeId() == GeometryTypeId::GEOS_LINEARRING) { + return splitLineStringAtVertex(static_cast(sc), i); + } + + throw util::UnsupportedOperationException("Unhandled type in SplitGeometryAtVertex::splitAtVertex"); +} + +} \ No newline at end of file diff --git a/tests/unit/geom/CircularStringTest.cpp b/tests/unit/geom/CircularStringTest.cpp index c7522314d..6468696da 100644 --- a/tests/unit/geom/CircularStringTest.cpp +++ b/tests/unit/geom/CircularStringTest.cpp @@ -42,7 +42,7 @@ struct test_circularstring_data { auto expected = wktreader_.read(wkt_expected); - ensure_equals_exact_xyzm(cs->getCoordinatesRO(), expected->getCoordinatesRO(), 0); + ensure_equals_exact_geometry_xyzm(cs.get(), expected.get(), 0); } }; diff --git a/tests/unit/geom/CompoundCurveTest.cpp b/tests/unit/geom/CompoundCurveTest.cpp index 499fd3699..ac33abade 100644 --- a/tests/unit/geom/CompoundCurveTest.cpp +++ b/tests/unit/geom/CompoundCurveTest.cpp @@ -44,6 +44,15 @@ struct test_compoundcurve_data { cc_ = factory_->createCompoundCurve(std::move(curves)); } + void checkNormalize(const std::string& wkt_in, const std::string& wkt_expected) const { + auto cs = wktreader_.read(wkt_in); + cs->normalize(); + + auto expected = wktreader_.read(wkt_expected); + + ensure_equals_exact_geometry_xyzm(cs.get(), expected.get(), 0); + } + }; typedef test_group group; @@ -128,6 +137,8 @@ template<> template<> void object::test<3>() { + set_test_name("operations"); + // Predicates ensure_THROW(cc_->contains(cc_.get()), geos::util::UnsupportedOperationException); ensure_THROW(cc_->coveredBy(cc_.get()), geos::util::UnsupportedOperationException); @@ -180,7 +191,6 @@ void object::test<3>() ensure("reverse", cc_->reverse()->equalsIdentical(wktreader_.read("" "COMPOUNDCURVE ((2 2, 2 0), CIRCULARSTRING (2 0, 1 1, 0 0))").get())); auto cc3 = cc_->reverse(); - ensure_THROW(cc3->normalize(), geos::util::UnsupportedOperationException); } // GeometryFilter @@ -337,6 +347,8 @@ template<> template<> void object::test<9>() { + set_test_name("cannot create non-contiguous CompoundCurve"); + std::vector> curves; curves.push_back(wktreader_.read("LINESTRING (0 0, 1 2)")); @@ -349,4 +361,49 @@ void object::test<9>() ensure_THROW(factory_->createCompoundCurve(std::move(curves)), geos::util::IllegalArgumentException); } +template<> +template<> +void object::test<10>() +{ + set_test_name("normalize non-closed CompoundCurve"); + + // already normalized + checkNormalize("COMPOUNDCURVE((-2 2, -3 5, 0 10), CIRCULARSTRING (0 10, -5 5, 0 0))", + "COMPOUNDCURVE((-2 2, -3 5, 0 10), CIRCULARSTRING (0 10, -5 5, 0 0))"); + + checkNormalize("COMPOUNDCURVE((-2 2, -3 5, 0 10), CIRCULARSTRING (0 10, -5 5, 0 0))", + "COMPOUNDCURVE((-2 2, -3 5, 0 10), CIRCULARSTRING (0 10, -5 5, 0 0))"); + + // needs to be reversed + checkNormalize("COMPOUNDCURVE(CIRCULARSTRING (0 0, -5 5, 0 10), (0 10, -3 5, -2 2))", + "COMPOUNDCURVE((-2 2, -3 5, 0 10), CIRCULARSTRING (0 10, -5 5, 0 0))"); +} + +template<> +template<> +void object::test<11>() +{ + set_test_name("normalize closed CompoundCurve"); + // already normalized + checkNormalize("COMPOUNDCURVE(CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, -5 0))", + "COMPOUNDCURVE(CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, -5 0))"); + + // needs to be reversed + checkNormalize("COMPOUNDCURVE((-5 0, 5 0), CIRCULARSTRING(5 0, 0 5, -5 0))", + "COMPOUNDCURVE(CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, -5 0))"); + + // needs to be reversed and scrolled + checkNormalize("COMPOUNDCURVE((5 0, -5 0), CIRCULARSTRING(-5 0, 0 5, 5 0))", + "COMPOUNDCURVE(CIRCULARSTRING(-5 0, 0 5, 5 0), (5 0, -5 0))"); + + // needs to be reversed and scrolled, but no geometries split + // actual minimum point is a control point and cannot become the origin + checkNormalize("COMPOUNDCURVE (CIRCULARSTRING (0 10, -5 5, 0 0), (0 0, 0 10))", + "COMPOUNDCURVE(CIRCULARSTRING (0 0, -5 5, 0 10), (0 10, 0 0))"); + + // needs to be reversed, scrolled, split + checkNormalize("COMPOUNDCURVE (CIRCULARSTRING (10 0, 0 -10, -10 0, -5 5, 0 0), (0 0, 10 0))", + "COMPOUNDCURVE (CIRCULARSTRING (-10 0, -5 5, 0 0), (0 0, 10 0), CIRCULARSTRING (10 0, 0 -10, -10 0))"); +} + } diff --git a/tests/unit/geom/MultiCurveTest.cpp b/tests/unit/geom/MultiCurveTest.cpp index 1ca766cf1..365e77e7b 100644 --- a/tests/unit/geom/MultiCurveTest.cpp +++ b/tests/unit/geom/MultiCurveTest.cpp @@ -131,6 +131,8 @@ template<> template<> void object::test<3>() { + set_test_name("operations"); + // Predicates ensure_THROW(mc_->contains(mc_.get()), geos::util::UnsupportedOperationException); ensure_THROW(mc_->coveredBy(mc_.get()), geos::util::UnsupportedOperationException); @@ -183,7 +185,6 @@ void object::test<3>() " (10 11, 8 9)," " CIRCULARSTRING (1.7 1, 1.6 0.5, 1.6 0.4, 1.4 0.4, 1.7 1))").get())); auto cc3 = mc_->reverse(); - ensure_THROW(cc3->normalize(), geos::util::UnsupportedOperationException); } // isClosed diff --git a/tests/unit/operation/split/SplitGeometryAtVertexTest.cpp b/tests/unit/operation/split/SplitGeometryAtVertexTest.cpp new file mode 100644 index 000000000..da1a96449 --- /dev/null +++ b/tests/unit/operation/split/SplitGeometryAtVertexTest.cpp @@ -0,0 +1,101 @@ +#include +#include +#include + +#include +#include +#include +#include + +using geos::geom::CircularString; +using geos::geom::LineString; +using geos::operation::split::SplitGeometryAtVertex; + +namespace tut { + +struct test_splitgeometryatvertex_data { + const geos::io::WKTReader reader_; +}; + +typedef test_group group; +typedef group::object object; + +group test_splitgeometryatvertextest_group("geos::operation::split::SplitGeometryAtVertex"); + +template<> +template<> +void object::test<1>() +{ + set_test_name("LineString"); + + auto input = reader_.read("LINESTRING ZM (0 3 2 3, 5 8 3 4, 2 2 4 5, 6 1 5 6)"); + + { + auto splitAtStart = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, 0); + + ensure(splitAtStart.first->isEmpty()); + ensure(splitAtStart.first->hasZ()); + ensure(splitAtStart.first->hasM()); + ensure(splitAtStart.second->equalsIdentical(input.get())); + } + + { + auto splitAtEnd = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, input->getNumPoints() - 1); + + ensure(splitAtEnd.first->equalsIdentical(input.get())); + ensure(splitAtEnd.second->isEmpty()); + ensure(splitAtEnd.second->hasZ()); + ensure(splitAtEnd.second->hasM()); + } + + { + auto splitInMiddle = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, 2); + + auto expectedFirst = reader_.read("LINESTRING ZM (0 3 2 3, 5 8 3 4, 2 2 4 5)"); + auto expectedSecond = reader_.read("LINESTRING ZM (2 2 4 5, 6 1 5 6)"); + + ensure(splitInMiddle.first->equalsIdentical(expectedFirst.get())); + ensure(splitInMiddle.second->equalsIdentical(expectedSecond.get())); + } +} + +template<> +template<> +void object::test<2>() +{ + set_test_name("CircularString"); + + auto input = reader_.read("CIRCULARSTRING ZM (-5 0 1 2, 0 5 2 3, 5 0 3 4, 10 -5 4 5, 15 0 5 6)"); + + { + auto splitAtStart = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, 0); + + ensure(splitAtStart.first->isEmpty()); + ensure(splitAtStart.first->hasZ()); + ensure(splitAtStart.first->hasM()); + ensure(splitAtStart.second->equalsIdentical(input.get())); + } + + { + auto splitAtEnd = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, input->getNumPoints() - 1); + + ensure(splitAtEnd.first->equalsIdentical(input.get())); + ensure(splitAtEnd.second->isEmpty()); + ensure(splitAtEnd.second->hasZ()); + ensure(splitAtEnd.second->hasM()); + } + + { + auto splitInMiddle = SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, 2); + + auto expectedFirst = reader_.read("CIRCULARSTRING ZM (-5 0 1 2, 0 5 2 3, 5 0 3 4)"); + auto expectedSecond = reader_.read("CIRCULARSTRING ZM (5 0 3 4, 10 -5 4 5, 15 0 5 6)"); + + ensure(splitInMiddle.first->equalsIdentical(expectedFirst.get())); + ensure(splitInMiddle.second->equalsIdentical(expectedSecond.get())); + } + + ensure_THROW(SplitGeometryAtVertex::splitSimpleCurveAtVertex(*input, 1), geos::util::IllegalArgumentException); +} + +} diff --git a/tests/unit/utility.h b/tests/unit/utility.h index 1e20cf61d..7736d6de6 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -394,9 +394,8 @@ ensure_equals_exact_geometry_xyz(const geos::geom::Geometry *lhs_in, using geos::geom::CoordinateSequence; using geos::geom::GeometryCollection; - ensure_equals("type id do not match", - lhs_in->getGeometryTypeId(), rhs_in->getGeometryTypeId()); - + ensure_equals("types do not match", + lhs_in->getGeometryType(), rhs_in->getGeometryType()); if (const Point* gpt1 = dynamic_cast(lhs_in)) { const Point *gpt2 = static_cast(rhs_in); @@ -453,8 +452,8 @@ ensure_equals_exact_geometry_xyzm(const geos::geom::Geometry *lhs_in, using geos::geom::CoordinateSequence; using geos::geom::GeometryCollection; - ensure_equals("type id do not match", - lhs_in->getGeometryTypeId(), rhs_in->getGeometryTypeId()); + ensure_equals("types do not match", + lhs_in->getGeometryType(), rhs_in->getGeometryType()); if (const Point* gpt1 = dynamic_cast(lhs_in)) { const Point *gpt2 = static_cast(rhs_in); commit c89ef8e0f371ca82387f821b011c64a02012cba4 Author: Daniel Baston Date: Tue Mar 10 11:00:39 2026 -0400 geos_unit: support CompoundCurve in ensure_geometry_equals_exact_xyzm diff --git a/tests/unit/utility.h b/tests/unit/utility.h index ba456c34c..1e20cf61d 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -9,6 +9,7 @@ // geos #include #include +#include #include #include #include @@ -446,6 +447,7 @@ ensure_equals_exact_geometry_xyzm(const geos::geom::Geometry *lhs_in, using geos::geom::Point; using geos::geom::Curve; + using geos::geom::CompoundCurve; using geos::geom::SimpleCurve; using geos::geom::Surface; using geos::geom::CoordinateSequence; @@ -462,6 +464,17 @@ ensure_equals_exact_geometry_xyzm(const geos::geom::Geometry *lhs_in, const SimpleCurve *gln2 = static_cast(rhs_in); return ensure_equals_exact_xyzm(gln1->getCoordinatesRO(), gln2->getCoordinatesRO(), tolerance); } + else if (const CompoundCurve* cc1 = dynamic_cast(lhs_in)) { + const CompoundCurve *cc2 = static_cast(rhs_in); + + ensure_equals("number of curves does not match", + cc1->getNumCurves(), + cc2->getNumCurves()); + + for (std::size_t i =0; i < cc1->getNumCurves(); i++) { + ensure_equals_exact_geometry_xyzm(cc1->getCurveN(i), cc2->getCurveN(i), tolerance); + } + } else if (const Surface* gply1 = dynamic_cast(lhs_in)) { const Surface* gply2 = static_cast(rhs_in); const Curve* extRing1 = gply1->getExteriorRing(); commit 377631cf28007b1d59649b9cb6dcd8bf23083fcc Author: Daniel Baston Date: Tue Mar 10 10:25:37 2026 -0400 CircularString: Support normalize() diff --git a/include/geos/geom/CircularArc.h b/include/geos/geom/CircularArc.h index 184b07f46..067e5ba39 100644 --- a/include/geos/geom/CircularArc.h +++ b/include/geos/geom/CircularArc.h @@ -101,6 +101,8 @@ public: return m_pos; } + Envelope getEnvelope() const; + /// Return the length of the arc double getLength() const; diff --git a/include/geos/geom/CircularString.h b/include/geos/geom/CircularString.h index e38a5b640..54089f3bc 100644 --- a/include/geos/geom/CircularString.h +++ b/include/geos/geom/CircularString.h @@ -48,6 +48,8 @@ public: return true; } + void normalize() override; + std::unique_ptr reverse() const { return std::unique_ptr(reverseImpl()); @@ -87,6 +89,8 @@ protected: private: void createArcs() const; + void normalizeClosed(); + mutable std::vector arcs; }; diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h index c284b9bc2..b19b0f5ec 100644 --- a/include/geos/geom/CoordinateSequence.h +++ b/include/geos/geom/CoordinateSequence.h @@ -624,9 +624,14 @@ public: /// Get a string representation of CoordinateSequence std::string toString() const; - /// Returns lower-left Coordinate in list + /// Returns lower-left Coordinate in list, or nullptr if the + /// sequence is empty const CoordinateXY* minCoordinate() const; + /// Returns the index of the minCoordinate, or the maximum value of + /// size_t if the sequence is empty + std::size_t minCoordinateIndex() const; + /** \brief * Returns either the given CoordinateSequence if its length * is greater than the given amount, or an empty CoordinateSequence. @@ -658,6 +663,8 @@ public: /// Scroll given CoordinateSequence so to start with given Coordinate. static void scroll(CoordinateSequence* cl, const CoordinateXY* firstCoordinate); + void scroll(const CoordinateXY* firstCoordinate); + void scroll(std::size_t firstCoordinateIndex); /** \brief * Determines which orientation of the {@link Coordinate} array diff --git a/include/geos/geom/LineString.h b/include/geos/geom/LineString.h index 8d59cda5a..25764c73d 100644 --- a/include/geos/geom/LineString.h +++ b/include/geos/geom/LineString.h @@ -96,6 +96,14 @@ public: return false; } + /** \brief + * Normalizes a LineString. + * + * A normalized LineString has the first point which is not equal to + * its reflected point less than the reflected point. + */ + void normalize() override; + /** * Creates a LineString whose coordinates are in the reverse * order of this object's @@ -134,6 +142,8 @@ protected: private: + void normalizeClosed(); + void validateConstruction(); }; diff --git a/include/geos/geom/Polygon.h b/include/geos/geom/Polygon.h index aabc4d866..98e4fe262 100644 --- a/include/geos/geom/Polygon.h +++ b/include/geos/geom/Polygon.h @@ -129,7 +129,7 @@ protected: private: - void normalize(LinearRing* ring, bool clockwise); + static void normalize(LinearRing* ring, bool clockwise); }; diff --git a/include/geos/geom/SimpleCurve.h b/include/geos/geom/SimpleCurve.h index 9d0538058..2c7e4c8f4 100644 --- a/include/geos/geom/SimpleCurve.h +++ b/include/geos/geom/SimpleCurve.h @@ -101,15 +101,6 @@ public: bool isEmpty() const override; - /** \brief - * Normalizes a SimpleCurve. - * - * A normalized simple curve - * has the first point which is not equal to its reflected point - * less than the reflected point. - */ - void normalize() override; - protected: SimpleCurve(const SimpleCurve& other); @@ -128,11 +119,6 @@ protected: std::shared_ptr points; mutable Envelope envelope; - - -private: - - void normalizeClosed(); }; } diff --git a/src/geom/CircularArc.cpp b/src/geom/CircularArc.cpp index 9b5476953..1ec27bbe6 100644 --- a/src/geom/CircularArc.cpp +++ b/src/geom/CircularArc.cpp @@ -276,6 +276,13 @@ CircularArc::getArea() const { return R*R/2*(theta - std::sin(theta)); } +Envelope +CircularArc::getEnvelope() const { + Envelope env; + algorithm::CircularArcs::expandEnvelope(env, p0(), p1(), p2()); + return env; +} + double CircularArc::getLength() const { if (isLinear()) { diff --git a/src/geom/CircularString.cpp b/src/geom/CircularString.cpp index ebfdd765b..fe6b79cd5 100644 --- a/src/geom/CircularString.cpp +++ b/src/geom/CircularString.cpp @@ -94,6 +94,66 @@ CircularString::getLength() const return tot; } +void +CircularString::normalize() +{ + if (isEmpty()) return; + + assert(points.get()); + if (isClosed()) { + normalizeClosed(); + return; + } + + if (points->front().compareTo( points->back()) == 1) { + if (points.use_count() > 1) { + points = points->clone(); + } + const_cast(points.get())->reverse(); + arcs.clear(); + } +} + +/*private*/ +void +CircularString::normalizeClosed() +{ + if (isEmpty()) { + return; + } + + const auto& ringCoords = getCoordinatesRO(); + const bool reverse = ringCoords->size() >= 4 && algorithm::Orientation::isCCW(ringCoords); + + std::size_t minInd = 0; + const CoordinateXY* minPt = &ringCoords->getAt(minInd); + for (std::size_t i = 2; i < ringCoords->size() - 2; i++) { + const CoordinateXY& pt = ringCoords->getAt(i); + if (pt.compareTo(*minPt) < 0) { + minInd = i; + minPt = &pt; + } + } + + if (minInd > 0) { + auto coords = std::make_shared(0u, ringCoords->hasZ(), ringCoords->hasM()); + coords->reserve(ringCoords->size()); + + coords->add(*ringCoords, minInd, ringCoords->size() - 2); + coords->add(*ringCoords, 0, minInd); + + if (reverse) { + coords->reverse(); + } + points = std::move(coords); + } else if (reverse) { + if (points.use_count() > 1) { + points = points->clone(); + } + const_cast(points.get())->reverse(); + } +} + CircularString* CircularString::reverseImpl() const { diff --git a/src/geom/CoordinateSequence.cpp b/src/geom/CoordinateSequence.cpp index 865f97a44..cd97014e3 100644 --- a/src/geom/CoordinateSequence.cpp +++ b/src/geom/CoordinateSequence.cpp @@ -361,15 +361,26 @@ CoordinateSequence::atLeastNCoordinatesOrNothing(std::size_t n, const CoordinateXY* CoordinateSequence::minCoordinate() const +{ + if (isEmpty()) { + return nullptr; + } + return &getAt(minCoordinateIndex()); +} + +std::size_t +CoordinateSequence::minCoordinateIndex() const { const CoordinateXY* minCoord = nullptr; + std::size_t minIndex = std::numeric_limits::max(); const std::size_t p_size = getSize(); for(std::size_t i = 0; i < p_size; i++) { if(minCoord == nullptr || minCoord->compareTo(getAt(i)) > 0) { minCoord = &getAt(i); + minIndex = i; } } - return minCoord; + return minIndex; } size_t @@ -386,17 +397,28 @@ CoordinateSequence::indexOf(const CoordinateXY* coordinate, } void -CoordinateSequence::scroll(CoordinateSequence* cl, - const CoordinateXY* firstCoordinate) +CoordinateSequence::scroll(CoordinateSequence* cl, const CoordinateXY* firstCoordinate) { - std::size_t ind = indexOf(firstCoordinate, cl); + cl->scroll(firstCoordinate); +} + +void +CoordinateSequence::scroll(const CoordinateXY* firstCoordinate) +{ + std::size_t ind = indexOf(firstCoordinate, this); if(ind == 0 || ind == std::numeric_limits::max()) { return; // not found or already first } - std::rotate(cl->m_vect.begin(), - std::next(cl->m_vect.begin(), static_cast(ind * cl->stride())), - cl->m_vect.end()); + scroll(ind); +} + +void +CoordinateSequence::scroll(size_t ind) +{ + std::rotate(m_vect.begin(), + std::next(m_vect.begin(), static_cast(ind * stride())), + m_vect.end()); } int diff --git a/src/geom/LineString.cpp b/src/geom/LineString.cpp index fb52a2c5e..b3f1ceb26 100644 --- a/src/geom/LineString.cpp +++ b/src/geom/LineString.cpp @@ -122,5 +122,63 @@ LineString::getGeometryTypeId() const return GEOS_LINESTRING; } +void +LineString::normalize() +{ + if (isEmpty()) return; + assert(points.get()); + if (isClosed()) { + normalizeClosed(); + return; + } + std::size_t npts = points->getSize(); + std::size_t n = npts / 2; + for (std::size_t i = 0; i < n; i++) { + std::size_t j = npts - 1 - i; + if (!(points->getAt(i) == points->getAt(j))) { + if (points->getAt(i).compareTo(points->getAt(j)) > 0) { + if (points.use_count() > 1) { + points = points->clone(); + } + const_cast(points.get())->reverse(); + } + return; + } + } +} + +/*private*/ +void +LineString::normalizeClosed() +{ + if (isEmpty()) { + return; + } + + const auto& ringCoords = getCoordinatesRO(); + std::size_t minIndex = ringCoords->minCoordinateIndex(); + + const bool isCCW = ringCoords->size() >= 4 && Orientation::isCCW(ringCoords); + + if (minIndex == 0 && !isCCW) { + // already normalized + return; + } + + auto coords = std::make_shared(0u, ringCoords->hasZ(), ringCoords->hasM()); + coords->reserve(ringCoords->size()); + // exclude last point (repeated) + coords->add(*ringCoords, 0, ringCoords->size() - 2); + coords->scroll(minIndex); + coords->closeRing(true); + + if (isCCW) { + coords->reverse(); + } + + points = coords; +} + + } // namespace geos::geom } // namespace geos diff --git a/src/geom/Polygon.cpp b/src/geom/Polygon.cpp index 850331c04..116374ca9 100644 --- a/src/geom/Polygon.cpp +++ b/src/geom/Polygon.cpp @@ -118,18 +118,25 @@ Polygon::normalize(LinearRing* ring, bool clockwise) } const auto& ringCoords = ring->getCoordinatesRO(); + std::size_t minCoordinateIndex = ringCoords->minCoordinateIndex(); + + const bool switchOrientation = algorithm::Orientation::isCCW(ringCoords) == clockwise; + + if (minCoordinateIndex == 0 && !switchOrientation) { + // already normalized + return; + } + CoordinateSequence coords(0u, ringCoords->hasZ(), ringCoords->hasM()); coords.reserve(ringCoords->size()); // exclude last point (repeated) coords.add(*ringCoords, 0, ringCoords->size() - 2); - const CoordinateXY* minCoordinate = coords.minCoordinate(); - - CoordinateSequence::scroll(&coords, minCoordinate); + coords.scroll(minCoordinateIndex); coords.closeRing(); - if(algorithm::Orientation::isCCW(&coords) == clockwise) { + if(switchOrientation) { coords.reverse(); } ring->setPoints(&coords); diff --git a/src/geom/SimpleCurve.cpp b/src/geom/SimpleCurve.cpp index 21fd40c88..e882f8fdf 100644 --- a/src/geom/SimpleCurve.cpp +++ b/src/geom/SimpleCurve.cpp @@ -330,60 +330,5 @@ SimpleCurve::isEmpty() const return points->isEmpty(); } -/*public*/ -void -SimpleCurve::normalize() -{ - util::ensureNoCurvedComponents(*this); - - if (isEmpty()) return; - assert(points.get()); - if (isClosed()) { - normalizeClosed(); - return; - } - std::size_t npts = points->getSize(); - std::size_t n = npts / 2; - for (std::size_t i = 0; i < n; i++) { - std::size_t j = npts - 1 - i; - if (!(points->getAt(i) == points->getAt(j))) { - if (points->getAt(i).compareTo(points->getAt(j)) > 0) { - if (points.use_count() > 1) { - points = points->clone(); - } - const_cast(points.get())->reverse(); - } - return; - } - } -} - -/*private*/ -void -SimpleCurve::normalizeClosed() -{ - if (isEmpty()) { - return; - } - - const auto& ringCoords = getCoordinatesRO(); - - auto coords = detail::make_unique(0u, ringCoords->hasZ(), ringCoords->hasM()); - coords->reserve(ringCoords->size()); - // exclude last point (repeated) - coords->add(*ringCoords, 0, ringCoords->size() - 2); - - const CoordinateXY* minCoordinate = coords->minCoordinate(); - - CoordinateSequence::scroll(coords.get(), minCoordinate); - coords->closeRing(true); - - if (coords->size() >= 4 && algorithm::Orientation::isCCW(coords.get())) { - coords->reverse(); - } - - points = std::move(coords); -} - } // namespace geos::geom } // namespace geos diff --git a/tests/unit/geom/CircularStringTest.cpp b/tests/unit/geom/CircularStringTest.cpp index 8204468c8..c7522314d 100644 --- a/tests/unit/geom/CircularStringTest.cpp +++ b/tests/unit/geom/CircularStringTest.cpp @@ -35,6 +35,15 @@ struct test_circularstring_data { cs_ = factory_->createCircularString(seq); } + + void checkNormalize(const std::string& wkt_in, const std::string& wkt_expected) const { + auto cs = wktreader_.read(wkt_in); + cs->normalize(); + + auto expected = wktreader_.read(wkt_expected); + + ensure_equals_exact_xyzm(cs->getCoordinatesRO(), expected->getCoordinatesRO(), 0); + } }; typedef test_group group; @@ -158,7 +167,6 @@ void object::test<3>() ensure("reverse", cs_->reverse()->equalsIdentical(wktreader_.read("CIRCULARSTRING (4 0, 3 -1, 2 0, 1 1, 0 0)").get())); auto cs3 = cs_->reverse(); - ensure_THROW(cs3->normalize(), geos::util::UnsupportedOperationException); } // SimpleCurve API @@ -212,4 +220,70 @@ void object::test<6>() ensure(arcs.empty()); } +template<> +template<> +void object::test<7>() +{ + set_test_name("normalize of closed CircularString"); + + // circle, already normalized + checkNormalize("CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)", + "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)"); + + // circle, start point is OK but need to reverse points + checkNormalize("CIRCULARSTRING (-5 0, 0 -5, 5 0, 0 5, -5 0)", + "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)"); + + // circle, need to change start point but orientation is OK + checkNormalize("CIRCULARSTRING (5 0, 0 -5, -5 0, 0 5, 5 0)", + "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)"); + + // circle, need to change start point and orientation + checkNormalize("CIRCULARSTRING (5 0, 0 5, -5 0, 0 -5, 5 0)", + "CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0)"); + + // half-moon, already normalized + checkNormalize("CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)", + "CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)"); + + // half-moon, already normalized + checkNormalize("CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)", + "CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)"); + + // half-moon, start point is OK but need to make CW + checkNormalize("CIRCULARSTRING (0 0, -3 5, 0 10, -5 5, 0 0)", + "CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)"); + + // half-moon, need to change start point but orientation is OK + checkNormalize("CIRCULARSTRING (0 10, -3 5, 0 0, -5 5, 0 10)", + "CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)"); + + // half-moon, need to change start point and orientation + checkNormalize("CIRCULARSTRING (0 10, -5 5, 0 0, -3 5, 0 10)", + "CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, 0 0)"); +} + +template<> +template<> +void object::test<8>() +{ + set_test_name("normalize open CircularString"); + + // already normalized + checkNormalize("CIRCULARSTRING (-10 0, 0 10, 10 0, 0 5, -5 0)", + "CIRCULARSTRING (-10 0, 0 10, 10 0, 0 5, -5 0)"); + + // need to reverse + checkNormalize("CIRCULARSTRING (-5 0, 0 5, 10 0, 0 10, -10 0)", + "CIRCULARSTRING (-10 0, 0 10, 10 0, 0 5, -5 0)"); + + // already normalized + checkNormalize("CIRCULARSTRING (-2 2, -3 5, 0 10, -5 5, 0 0)", + "CIRCULARSTRING (-2 2, -3 5, 0 10, -5 5, 0 0)"); + + // need to reverse + checkNormalize("CIRCULARSTRING (0 0, -5 5, 0 10, -3 5, -2 2)", + "CIRCULARSTRING (-2 2, -3 5, 0 10, -5 5, 0 0)"); +} + } ----------------------------------------------------------------------- Summary of changes: include/geos/geom/CircularArc.h | 2 + include/geos/geom/CircularString.h | 6 +- include/geos/geom/CompoundCurve.h | 4 + include/geos/geom/CoordinateSequence.h | 9 +- include/geos/geom/Curve.h | 2 + include/geos/geom/LineString.h | 10 ++ include/geos/geom/Polygon.h | 2 +- include/geos/geom/SimpleCurve.h | 14 +-- .../geos/operation/split/SplitGeometryAtVertex.h | 43 +++++++++ src/geom/CircularArc.cpp | 7 ++ src/geom/CircularString.cpp | 60 ++++++++++++ src/geom/CompoundCurve.cpp | 93 ++++++++++++++++++- src/geom/CoordinateSequence.cpp | 36 ++++++-- src/geom/Curve.cpp | 6 ++ src/geom/CurvePolygon.cpp | 12 ++- src/geom/LineString.cpp | 51 +++++++++++ src/geom/Polygon.cpp | 15 ++- src/geom/SimpleCurve.cpp | 55 +---------- src/operation/split/SplitGeometryAtVertex.cpp | 84 +++++++++++++++++ tests/unit/geom/CircularStringTest.cpp | 76 +++++++++++++++- tests/unit/geom/CompoundCurveTest.cpp | 59 +++++++++++- tests/unit/geom/CurvePolygonTest.cpp | 32 ++++++- tests/unit/geom/MultiCurveTest.cpp | 3 +- tests/unit/geom/MultiSurfaceTest.cpp | 3 +- .../operation/split/SplitGeometryAtVertexTest.cpp | 101 +++++++++++++++++++++ tests/unit/utility.h | 22 ++++- 26 files changed, 713 insertions(+), 94 deletions(-) create mode 100644 include/geos/operation/split/SplitGeometryAtVertex.h create mode 100644 src/operation/split/SplitGeometryAtVertex.cpp create mode 100644 tests/unit/operation/split/SplitGeometryAtVertexTest.cpp hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 18 05:35:02 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 18 Mar 2026 05:35:02 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. f1c154d67d6f0a71e76b7ced2f014d74b4f64b19 Message-ID: <20260318123503.2280E1C2F0D@trac.osgeo.org> 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 f1c154d67d6f0a71e76b7ced2f014d74b4f64b19 (commit) via 14f2d5c249ca70e9be8a8ae4d8198bcc6302e139 (commit) via b2f92977431b1e20e3e325f6607940198675cccc (commit) via fb2a200dede22869f47923ec37beeb34dc5b2803 (commit) via 0e20c737cdeb4ac240477a786087548b31a01277 (commit) via 59ff30ae5c7ffee252949b7cf16662f95cbef52d (commit) via b040a784c29565807d660067b45df300216137b1 (commit) from 62b3524601c63abb662ee7c8cae428c24fe92af0 (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 f1c154d67d6f0a71e76b7ced2f014d74b4f64b19 Author: Daniel Baston Date: Wed Mar 18 08:34:37 2026 -0400 GeometryPrecisionReducer: Preserve M in pointwise mode (#1401) diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index e21dcbdb1..630f1763f 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -5621,6 +5621,8 @@ extern GEOSGeometry GEOS_DLL *GEOSSnap( * So the combination GEOS_PREC_NO_TOPO || GEOS_PREC_KEEP_COLLAPSED * has the same semantics as GEOS_PREC_NO_TOPO * +* Z and M values in the input are preserved. +* * \param g Input geometry * \param gridSize cell size of grid to round coordinates to, * or 0 for FLOATING precision diff --git a/include/geos/precision/GeometryPrecisionReducer.h b/include/geos/precision/GeometryPrecisionReducer.h index de8afb120..c885d14a3 100644 --- a/include/geos/precision/GeometryPrecisionReducer.h +++ b/include/geos/precision/GeometryPrecisionReducer.h @@ -68,7 +68,7 @@ private: bool useAreaReducer; bool isPointwise; - geom::GeometryFactory::Ptr createFactory( + static geom::GeometryFactory::Ptr createFactory( const geom::GeometryFactory& oldGF, const geom::PrecisionModel& newPM); diff --git a/include/geos/precision/PointwisePrecisionReducerTransformer.h b/include/geos/precision/PointwisePrecisionReducerTransformer.h index 9ea06717f..cd92beb85 100644 --- a/include/geos/precision/PointwisePrecisionReducerTransformer.h +++ b/include/geos/precision/PointwisePrecisionReducerTransformer.h @@ -44,7 +44,7 @@ private: const geom::PrecisionModel& targetPM; std::unique_ptr reducePointwise( - const geom::CoordinateSequence* coordinates); + const geom::CoordinateSequence* coordinates) const; public: diff --git a/include/geos/precision/PrecisionReducerTransformer.h b/include/geos/precision/PrecisionReducerTransformer.h index 49d094913..2997149fe 100644 --- a/include/geos/precision/PrecisionReducerTransformer.h +++ b/include/geos/precision/PrecisionReducerTransformer.h @@ -50,9 +50,9 @@ private: const geom::PrecisionModel& targetPM; bool isRemoveCollapsed; - std::unique_ptr reduceArea(const geom::Geometry* geom); + std::unique_ptr reduceArea(const geom::Geometry* geom) const; - void extend( + static void extend( geom::CoordinateSequence& coords, std::size_t minLength); diff --git a/src/precision/PointwisePrecisionReducerTransformer.cpp b/src/precision/PointwisePrecisionReducerTransformer.cpp index 1b867b4b2..63985fdb1 100644 --- a/src/precision/PointwisePrecisionReducerTransformer.cpp +++ b/src/precision/PointwisePrecisionReducerTransformer.cpp @@ -49,7 +49,7 @@ PointwisePrecisionReducerTransformer::transformCoordinates(const CoordinateSeque (void)(parent); // ignore unused variable if (coords->isEmpty()) { - return detail::make_unique(0u, coords->getDimension()); + return detail::make_unique(0u, coords->hasZ(), coords->hasM()); } return reducePointwise(coords); @@ -58,13 +58,13 @@ PointwisePrecisionReducerTransformer::transformCoordinates(const CoordinateSeque /* private */ std::unique_ptr -PointwisePrecisionReducerTransformer::reducePointwise(const CoordinateSequence* coordinates) +PointwisePrecisionReducerTransformer::reducePointwise(const CoordinateSequence* coordinates) const { - auto coordReduce = detail::make_unique(); + auto coordReduce = detail::make_unique(0, coordinates->hasZ(), coordinates->hasM()); coordReduce->reserve(coordinates->size()); // copy coordinates and reduce - coordinates->forEach([&coordReduce, this](Coordinate coord) { + coordinates->forEach([&coordReduce, this](auto coord) { targetPM.makePrecise(coord); coordReduce->add(coord); }); diff --git a/src/precision/PrecisionReducerTransformer.cpp b/src/precision/PrecisionReducerTransformer.cpp index 74339e6c0..79148b2fe 100644 --- a/src/precision/PrecisionReducerTransformer.cpp +++ b/src/precision/PrecisionReducerTransformer.cpp @@ -169,7 +169,7 @@ PrecisionReducerTransformer::transformMultiPolygon( // private std::unique_ptr -PrecisionReducerTransformer::reduceArea(const Geometry* geom) +PrecisionReducerTransformer::reduceArea(const Geometry* geom) const { return operation::overlayng::PrecisionReducer::reducePrecision(geom, &targetPM); } diff --git a/tests/unit/precision/GeometryPrecisionReducerTest.cpp b/tests/unit/precision/GeometryPrecisionReducerTest.cpp index 7c2161ddf..2550a34bf 100644 --- a/tests/unit/precision/GeometryPrecisionReducerTest.cpp +++ b/tests/unit/precision/GeometryPrecisionReducerTest.cpp @@ -106,7 +106,7 @@ struct test_gpr_data { // std::cout << *actual << std::endl; - ensure_equals_geometry(expected.get(), actual.get()); + ensure_equals_geometry_xyzm(expected.get(), actual.get()); if (samePM) ensure("Factories are not the same", actual->getFactory() == g->getFactory()); else @@ -411,5 +411,34 @@ void object::test<28> () +template<> +template<> +void object::test<34>() +{ + set_test_name("empty LineString ZM pointwise"); + + checkReducePointwise("LINESTRING ZM EMPTY", "LINESTRING ZM EMPTY"); +} + +template<> +template<> +void object::test<35>() +{ + set_test_name("LineString ZM pointwise"); + + checkReducePointwise("LINESTRING ZM (1.23 4.56 7.89 9.87, 2.34 5.67 0.21 0.24)", + "LINESTRING ZM (1 5 7.89 9.87, 2 6 0.21 0.24)"); +} + +template<> +template<> +void object::test<36>() +{ + set_test_name("LineString ZM"); + + checkReduce("LINESTRING ZM (1.23 4.56 7.89 9.87, 2.34 5.67 0.21 0.24)", + "LINESTRING ZM (1 5 7.89 9.87, 2 6 0.21 0.24)"); +} + } // namespace tut commit 14f2d5c249ca70e9be8a8ae4d8198bcc6302e139 Author: Daniel Baston Date: Wed Mar 11 14:05:32 2026 -0400 C API: Correct description of GEOSisClosed diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 29e7ed528..e21dcbdb1 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3356,9 +3356,13 @@ extern char GEOS_DLL GEOSHasM(const GEOSGeometry* g); /** * Tests whether the input geometry is closed. -* A closed geometry is a LineString, MultiLineString, CircularString, -* CompoundCurve, or MultiCurve with the start and end points having -* the same XY values. Z and M values are not considered. +* A closed geometry is either: +* - a non-empty LineString, CircularString, or CompoundCurve whose +* start and end points having the same XY values; or +* - a non-empty MultiLineString or MultiCurve whose elements are +* all closed. +* +* Z and M values are not considered. * * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception commit b2f92977431b1e20e3e325f6607940198675cccc Author: Daniel Baston Date: Wed Mar 11 12:29:40 2026 -0400 C API: Add comments on curve support diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 45828c4ac..29e7ed528 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3656,6 +3656,11 @@ extern GEOSGeometry GEOS_DLL *GEOSRemoveRepeatedPoints( /** * Calculate the area of a geometry. +* +* Curved geometry types are supported since GEOS 3.13. +* +* Area is calculated in the XY plane; Z and M values are ignored. +* * \param[in] g Input geometry * \param[out] area Pointer to be filled in with area result * \return 1 on success, 0 on exception. @@ -3667,6 +3672,9 @@ extern int GEOS_DLL GEOSArea( /** * Calculate the length of a geometry. +* +* Curved geometry types are supported since GEOS 3.13. +* * Length is calculated in the XY plane; Z and M values are ignored. * \param[in] g Input geometry * \param[out] length Pointer to be filled in with length result @@ -4762,6 +4770,8 @@ GEOSCoverageClean( * * Z and M values in the input coordinates are ignored. * +* Cuved geometry types are supported as of GEOS 3.13. +* * \param g The geometry to calculate an envelope for * \return A newly allocated polygonal envelope or point. NULL on exception. * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5211,6 +5221,8 @@ extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram( * Z and M values of input coordinates will be preserved. * Z and M values at constructed points will be interpolated. * +* Curved geometry types are supported since GEOS 3.15. +* * \param g The input geometry * \return The noded geometry or NULL on exception * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5423,6 +5435,9 @@ extern GEOSGeometry GEOS_DLL *GEOSLineSubstring( * of the sequences. Converts CCW rings to CW. Reverses direction * of LineStrings. Z and M values of the input coordinates are * preserved. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param g The input geometry * \return The reversed geometry * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5480,6 +5495,8 @@ extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify( * Z values on the retained coordinates will be preserved. * M values will not be preserved. * +* Curved geometry types are supported since GEOS 3.13. +* * \param g The input geometry * \return The distinct points * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5515,6 +5532,9 @@ extern int GEOS_DLL GEOSHilbertCode( * Apply XY coordinate transform callback to all coordinates in a copy of * input geometry. If the callback returns an error, returned geometry will be * NULL. Z and M values, if present, are not modified by this function. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[in] callback a function to be executed for each coordinate in the geometry. The callback takes 3 parameters: x and y coordinate @@ -5534,6 +5554,9 @@ extern GEOSGeometry GEOS_DLL *GEOSGeom_transformXY( * Apply XYZ coordinate transform callback to all coordinates in a copy of * input geometry. If the callback returns an error, returned geometry will be * NULL. M values, if present, are not modified by this function. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[in] callback a function to be executed for each coordinate in the geometry. The callback takes 4 parameters: x, y and z coordinate @@ -5736,6 +5759,9 @@ extern char GEOS_DLL GEOSCoveredBy(const GEOSGeometry* g1, const GEOSGeometry* g * Unlike GEOSEquals(), geometries that are topologically equivalent but have different * representations (e.g., LINESTRING (0 0, 1 1) and MULTILINESTRING ((0 0, 1 1)) ) are not * considered equal by GEOSEqualsExact(). +* +* Curved geometry types are supported since GEOS 3.13. +* * \param g1 Input geometry * \param g2 Input geometry * \param tolerance Tolerance to determine vertex equality @@ -5749,11 +5775,13 @@ extern char GEOS_DLL GEOSEqualsExact( double tolerance); /** - * Determine pointwise equality of two geometries by checking - * that the structure, ordering, and values of all vertices are - * identical in all dimensions. NaN values are considered to be - * equal to other NaN values. - * +* Determine pointwise equality of two geometries by checking +* that the structure, ordering, and values of all vertices are +* identical in all dimensions. NaN values are considered to be +* equal to other NaN values. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param g1 Input geometry * \param g2 Input geometry * \returns 1 on true, 0 on false, 2 on exception commit fb2a200dede22869f47923ec37beeb34dc5b2803 Author: Daniel Baston Date: Wed Mar 11 12:27:26 2026 -0400 GEOSGeomGetLength: Support CircularString and CompoundCurve diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index eecf7f513..45828c4ac 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3403,10 +3403,12 @@ extern void GEOS_DLL GEOSGeom_setUserData(GEOSGeometry* g, void* userData); * - Rings start with their smallest coordinate * (using XY ordering) * - Polygon shell rings are oriented CW, and holes CCW -* - Collection elements are sorted by their first coordinate +* - Collection elements are sorted by their geometry type and first coordinate * * Coordinate Z and M values are not modified during normalization. * +* Curved geometry types are supported since GEOS 3.15. +* * Use before calling \ref GEOSEqualsExact to avoid false "not equal" results. * \param g Input geometry * \return 0 on success or -1 on exception @@ -3676,10 +3678,14 @@ extern int GEOS_DLL GEOSLength( double *length); /** -* Calculate the length of a LineString. -* Only works for LineString inputs, returns exception otherwise. +* Calculate the length of a LineString, CircularString, or CompoundCurve. +* +* Returns an exception if a different geometry type is provided. * Length is calculated in the XY plane; Z and M values are ignored. * +* CircularString and CompoundCurve arguments are supported since +* GEOS 3.15. +* * \param[in] g Input geometry * \param[out] length Pointer to be filled in with length result * \return 1 on success, 0 on exception. diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index aeac05f10..e57a00343 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -2146,16 +2146,16 @@ extern "C" { } /* - * Call only on LINESTRING - * return 0 on exception, otherwise 1 + * Call only on LineString, CircularString, or CompoundCurve + * Returns NULL on exception */ int GEOSGeomGetLength_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* length) { return execute(extHandle, 0, [&]() { - const LineString* ls = dynamic_cast(g1); + const Curve* ls = dynamic_cast(g1); if(!ls) { - throw IllegalArgumentException("Argument is not a LineString"); + throw IllegalArgumentException("Argument is not a Curve (LineString, CircularString, or CompoundCurve)"); } *length = ls->getLength(); return 1; diff --git a/tests/unit/capi/GEOSCircularStringTest.cpp b/tests/unit/capi/GEOSCircularStringTest.cpp index de7e67378..43a5dc30b 100644 --- a/tests/unit/capi/GEOSCircularStringTest.cpp +++ b/tests/unit/capi/GEOSCircularStringTest.cpp @@ -7,6 +7,7 @@ #include #include "capi_test_utils.h" +#include "geos/constants.h" namespace tut { // @@ -134,4 +135,15 @@ void object::test<7>() ensure_equals(GEOSGeom_getDimensions(cs_), 1); } +template<> +template<> +void object::test<8>() +{ + set_test_name("GEOSGeomGetLength"); + + double length = -1; + ensure_equals(GEOSGeomGetLength(cs_, &length), 1); + ensure_equals(length, geos::MATH_PI*1.5*5); +} + } // namespace tut diff --git a/tests/unit/capi/GEOSCompoundCurveTest.cpp b/tests/unit/capi/GEOSCompoundCurveTest.cpp index 81cf06600..a43aa63f9 100644 --- a/tests/unit/capi/GEOSCompoundCurveTest.cpp +++ b/tests/unit/capi/GEOSCompoundCurveTest.cpp @@ -3,6 +3,7 @@ #include // geos #include +#include // std #include @@ -130,4 +131,15 @@ void object::test<7>() ensure_equals(GEOSGeom_getDimensions(cc_), 1); } +template<> +template<> +void object::test<8>() +{ + set_test_name("GEOSGeomGetLength"); + + double length = -1; + ensure_equals(GEOSGeomGetLength(cc_, &length), 1); + ensure_equals(length, geos::MATH_PI*1.5*5 + 5); +} + } // namespace tut commit 0e20c737cdeb4ac240477a786087548b31a01277 Author: Daniel Baston Date: Wed Mar 11 12:13:08 2026 -0400 C API: Document/test coordinate accessors for curved types diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 47bbd44d2..eecf7f513 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3060,9 +3060,12 @@ extern double GEOS_DLL GEOSGeom_getPrecision(const GEOSGeometry *g); extern int GEOS_DLL GEOSGetNumInteriorRings(const GEOSGeometry* g); /** -* Returns the number of points, for a LineString input, or -* an exception otherwise. -* \param g Input LineString geometry +* Return the number of points in a linear geometry. +* +* CircularString inputs are supported since GEOS 3.14. +* CompoundCurve inputs are supported since GEOS 3.15. +* +* \param g Input geometry, must be a LineString, CircularString, or CompoundCurve * \return Number of points, -1 on exception * \since 2.2 */ @@ -3146,7 +3149,7 @@ extern int GEOS_DLL GEOSGetNumCoordinates( /** * Return the coordinate sequence underlying the -* given geometry (Must be a LineString, LinearRing or Point). +* given geometry (Must be a LineString, LinearRing, CircularString, or Point). * Do not directly free the coordinate sequence, it is owned by * the parent geometry. * \param g Input geometry @@ -3159,9 +3162,9 @@ extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq( /** * Return the planar dimensionality of the geometry. * -* - 0 for point, multipoint -* - 1 for linestring, multilinestring -* - 2 for polygon, multipolygon +* - 0 for Point, MultiPoint +* - 1 for LineString, MultiLineString, CircularString, CompoundCurve, MultiCurve +* - 2 for Polygon, MultiPolygon, CurvePolygon, MultiSurface * * \see geos::geom::Dimension::DimensionType * \param g Input geometry @@ -3175,7 +3178,8 @@ extern int GEOS_DLL GEOSGeom_getDimensions( * Return the cartesian dimension of the geometry. * * - 2 for XY data -* - 3 for XYZ data +* - 3 for XYZ or XYM data +* - 4 for XYZM data * * \param g Input geometry * \return The dimension @@ -3270,8 +3274,12 @@ extern int GEOS_DLL GEOSGeom_getExtent( double* ymax); /** -* Return the N'th point of a LineString -* \param g Input geometry, must be a LineString +* Return the N'th point of a linear geometry. +* +* CircularString inputs are supported since GEOS 3.14. +* CompoundCurve inputs are supported since GEOS 3.15. +* +* \param g Input geometry, must be a LineString, CircularString, or CompoundCurve * \param n Index of desired point (zero based) * \return A Point geometry. * Caller must free with GEOSGeom_destroy() @@ -3281,8 +3289,12 @@ extern int GEOS_DLL GEOSGeom_getExtent( extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN(const GEOSGeometry *g, int n); /** -* Return the first point of a LineString -* \param g Input geometry, must be a LineString +* Return the first point of a linear geometry. +* +* CircularString inputs are supported since GEOS 3.14. +* CompoundCurve inputs are supported since GEOS 3.15. +* +* \param g Input geometry, must be a LineString, CircularString, or CompoundCurve * \return A Point geometry. * Caller must free with GEOSGeom_destroy() * NULL on exception. @@ -3291,8 +3303,12 @@ extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN(const GEOSGeometry *g, int n); extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint(const GEOSGeometry *g); /** -* Return the last point of a LineString -* \param g Input geometry, must be a LineString +* Return the last point of a linear geometry. +* +* CircularString inputs are supported since GEOS 3.14. +* CompoundCurve inputs are supported since GEOS 3.15. +* +* \param g Input geometry, must be a LineString, CircularString, or CompoundCurve * \return A Point geometry. * Caller must free with GEOSGeom_destroy() * NULL on exception. @@ -3300,7 +3316,6 @@ extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint(const GEOSGeometry *g); */ extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint(const GEOSGeometry *g); - /** * Tests whether the input geometry is empty. If the geometry or any * component is non-empty, the geometry is non-empty. An empty geometry @@ -3341,9 +3356,10 @@ extern char GEOS_DLL GEOSHasM(const GEOSGeometry* g); /** * Tests whether the input geometry is closed. -* A closed geometry is a linestring or multilinestring -* with the start and end points having the same XY values. -* Z and M values are not considered. +* A closed geometry is a LineString, MultiLineString, CircularString, +* CompoundCurve, or MultiCurve with the start and end points having +* the same XY values. Z and M values are not considered. +* * \param g The geometry to test * \return 1 on true, 0 on false, 2 on exception * \since 3.3 diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index 78a96a612..aeac05f10 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -2067,16 +2067,16 @@ extern "C" { } /* - * Call only on LINESTRING + * Call only on LineString, CircularString, or CompoundCurve * Returns NULL on exception */ Geometry* GEOSGeomGetPointN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) { return execute(extHandle, [&]() { - const SimpleCurve* ls = dynamic_cast(g1); + const Curve* ls = dynamic_cast(g1); if(!ls) { - throw IllegalArgumentException("Argument is not a SimpleCurve"); + throw IllegalArgumentException("Argument is not a Curve (LineString, CircularString, or CompoundCurve)"); } if(n < 0) { throw IllegalArgumentException("Index must be non-negative."); @@ -2086,15 +2086,16 @@ extern "C" { } /* - * Call only on LINESTRING + * Call only on LineString, CircularString, or CompoundCurve + * Returns NULL on exception */ Geometry* GEOSGeomGetStartPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) { return execute(extHandle, [&]() { - const SimpleCurve* ls = dynamic_cast(g1); + const Curve* ls = dynamic_cast(g1); if(!ls) { - throw IllegalArgumentException("Argument is not a SimpleCurve"); + throw IllegalArgumentException("Argument is not a Curve (LineString, CircularString, or CompoundCurve)"); } return ls->getStartPoint().release(); @@ -2102,15 +2103,16 @@ extern "C" { } /* - * Call only on LINESTRING + * Call only on LineString, CircularString, or CompoundCurve + * Returns NULL on exception */ Geometry* GEOSGeomGetEndPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) { return execute(extHandle, [&]() { - const SimpleCurve* ls = dynamic_cast(g1); + const Curve* ls = dynamic_cast(g1); if(!ls) { - throw IllegalArgumentException("Argument is not a SimpleCurve"); + throw IllegalArgumentException("Argument is not a Curve (LineString, CircularString, or CompoundCurve)"); } return ls->getEndPoint().release(); }); @@ -2161,15 +2163,16 @@ extern "C" { } /* - * Call only on LINESTRING + * Call only on LineString, CircularString, or CompoundCurve + * Returns NULL on exception */ int GEOSGeomGetNumPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1) { return execute(extHandle, -1, [&]() { - const SimpleCurve* ls = dynamic_cast(g1); + const Curve* ls = dynamic_cast(g1); if(!ls) { - throw IllegalArgumentException("Argument is not a SimpleCurve"); + throw IllegalArgumentException("Argument is not a Curve (LineString, CircularString, or CompoundCurve)"); } return static_cast(ls->getNumPoints()); }); diff --git a/tests/unit/capi/GEOSCircularStringTest.cpp b/tests/unit/capi/GEOSCircularStringTest.cpp new file mode 100644 index 000000000..de7e67378 --- /dev/null +++ b/tests/unit/capi/GEOSCircularStringTest.cpp @@ -0,0 +1,137 @@ +// Test Suite for C-API CircularString functions + +#include +// geos +#include +// std +#include + +#include "capi_test_utils.h" + +namespace tut { +// +// Test Group +// + +// Common data used in test cases. +struct test_capicircularstring_data : public capitest::utility { + + GEOSGeometry* cs_; + + test_capicircularstring_data() { + cs_ = fromWKT("CIRCULARSTRING ZM (-5 0 6 7, 4 3 7 8 , 0 -5 8 9)"); + } + + ~test_capicircularstring_data() override { + GEOSGeom_destroy(cs_); + } +}; + +typedef test_group group; +typedef group::object object; + +group test_capicircularstring_group("capi::GEOSCircularString"); + +// +// Test Cases +// + +template<> +template<> +void object::test<1>() +{ + set_test_name("GEOSisClosed"); + + ensure_equals(GEOSisClosed(cs_), 0); +} + +template<> +template<> +void object::test<2>() +{ + set_test_name("GEOSGeomGetPointN"); + + double x, y, z, m; + result_ = GEOSGeomGetPointN(cs_, 1); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, 4); + ensure_equals(y, 3); + ensure_equals(z, 7); + ensure_equals(m, 8); +} + +template<> +template<> +void object::test<3>() +{ + set_test_name("GEOSGeomGetStartPoint"); + + double x, y, z, m; + result_ = GEOSGeomGetStartPoint(cs_); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, -5); + ensure_equals(y, 0); + ensure_equals(z, 6); + ensure_equals(m, 7); +} + +template<> +template<> +void object::test<4>() +{ + set_test_name("GEOSGeomGetEndPoint"); + + double x, y, z, m; + result_ = GEOSGeomGetEndPoint(cs_); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, 0); + ensure_equals(y, -5); + ensure_equals(z, 8); + ensure_equals(m, 9); +} + +template<> +template<> +void object::test<5>() +{ + set_test_name("GEOSGeomGetNumPoints"); + + ensure_equals(GEOSGeomGetNumPoints(cs_), 3); +} + +template<> +template<> +void object::test<6>() +{ + set_test_name("GEOSGeom_getCoordSeq"); + + const GEOSCoordSequence* seq = GEOSGeom_getCoordSeq(cs_); + ensure(seq); + + unsigned int size = 0; + ensure(GEOSCoordSeq_getSize(seq, &size)); + ensure_equals(size, 3u); +} + +template<> +template<> +void object::test<7>() +{ + set_test_name("GEOSGeom_getDimensions"); + + ensure_equals(GEOSGeom_getDimensions(cs_), 1); +} + +} // namespace tut diff --git a/tests/unit/capi/GEOSCompoundCurveTest.cpp b/tests/unit/capi/GEOSCompoundCurveTest.cpp new file mode 100644 index 000000000..81cf06600 --- /dev/null +++ b/tests/unit/capi/GEOSCompoundCurveTest.cpp @@ -0,0 +1,133 @@ +// Test Suite for C-API CompoundCurve functions + +#include +// geos +#include +// std +#include + +#include "capi_test_utils.h" + +namespace tut { +// +// Test Group +// + +// Common data used in test cases. +struct test_capicompoundcurve_data : public capitest::utility { + + GEOSGeometry* cc_; + + test_capicompoundcurve_data() { + cc_ = fromWKT("COMPOUNDCURVE(CIRCULARSTRING ZM (-5 0 6 7, 4 3 7 8 , 0 -5 8 9), (0 -5 8 9, -5 -5 9 10))"); + } + + ~test_capicompoundcurve_data() override { + GEOSGeom_destroy(cc_); + } +}; + +typedef test_group group; +typedef group::object object; + +group test_capicompoundcurve_group("capi::GEOSCompoundCurve"); + +// +// Test Cases +// + +template<> +template<> +void object::test<1>() +{ + set_test_name("GEOSisClosed"); + + ensure_equals(GEOSisClosed(cc_), 0); +} + +template<> +template<> +void object::test<2>() +{ + set_test_name("GEOSGeomGetPointN"); + + double x, y, z, m; + result_ = GEOSGeomGetPointN(cc_, 1); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, 4); + ensure_equals(y, 3); + ensure_equals(z, 7); + ensure_equals(m, 8); +} + +template<> +template<> +void object::test<3>() +{ + set_test_name("GEOSGeomGetStartPoint"); + + double x, y, z, m; + result_ = GEOSGeomGetStartPoint(cc_); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, -5); + ensure_equals(y, 0); + ensure_equals(z, 6); + ensure_equals(m, 7); +} + +template<> +template<> +void object::test<4>() +{ + set_test_name("GEOSGeomGetEndPoint"); + + double x, y, z, m; + result_ = GEOSGeomGetEndPoint(cc_); + GEOSGeomGetX(result_, &x); + GEOSGeomGetY(result_, &y); + GEOSGeomGetZ(result_, &z); + GEOSGeomGetM(result_, &m); + + ensure_equals(x, -5); + ensure_equals(y, -5); + ensure_equals(z, 9); + ensure_equals(m, 10); +} + +template<> +template<> +void object::test<5>() +{ + set_test_name("GEOSGeomGetNumPoints"); + + ensure_equals(GEOSGeomGetNumPoints(cc_), 5); +} + +template<> +template<> +void object::test<6>() +{ + set_test_name("GEOSGeom_getCoordSeq"); + + const GEOSCoordSequence* seq = GEOSGeom_getCoordSeq(cc_); + ensure(!seq); +} + +template<> +template<> +void object::test<7>() +{ + set_test_name("GEOSGeom_getDimensions"); + + ensure_equals(GEOSGeom_getDimensions(cc_), 1); +} + +} // namespace tut diff --git a/tests/unit/capi/capi_test_utils.h b/tests/unit/capi/capi_test_utils.h index 0b8d03284..7cc711ed7 100644 --- a/tests/unit/capi/capi_test_utils.h +++ b/tests/unit/capi/capi_test_utils.h @@ -37,7 +37,7 @@ namespace capitest { #endif } - ~utility() + virtual ~utility() { if (wktw_) GEOSWKTWriter_destroy(wktw_); if (geom1_) GEOSGeom_destroy(geom1_); commit 59ff30ae5c7ffee252949b7cf16662f95cbef52d Author: Daniel Baston Date: Wed Mar 11 12:09:28 2026 -0400 CompoundCurve: Support getPointN diff --git a/include/geos/geom/CompoundCurve.h b/include/geos/geom/CompoundCurve.h index ae22670e8..cb9243d9e 100644 --- a/include/geos/geom/CompoundCurve.h +++ b/include/geos/geom/CompoundCurve.h @@ -74,6 +74,8 @@ public: std::size_t getNumPoints() const override; + std::unique_ptr getPointN(std::size_t n) const override; + std::unique_ptr getStartPoint() const override; bool hasCurvedComponents() const override; diff --git a/include/geos/geom/Curve.h b/include/geos/geom/Curve.h index f9968fb9e..807760919 100644 --- a/include/geos/geom/Curve.h +++ b/include/geos/geom/Curve.h @@ -55,13 +55,16 @@ public: /// \brief /// Return the end point of the Curve /// or NULL if this is an EMPTY Curve. - /// virtual std::unique_ptr getEndPoint() const = 0; + /// \brief + /// Return the n'th point of the Curve + /// or NULL if this is an EMPTY Curve. + virtual std::unique_ptr getPointN(std::size_t n) const = 0; + /// \brief /// Return the start point of the Curve /// or NULL if this is an EMPTY Curve. - /// virtual std::unique_ptr getStartPoint() const = 0; /// Returns true if the first and last coordinate in the Curve are the same diff --git a/include/geos/geom/SimpleCurve.h b/include/geos/geom/SimpleCurve.h index 6fe96b40c..da24b0125 100644 --- a/include/geos/geom/SimpleCurve.h +++ b/include/geos/geom/SimpleCurve.h @@ -81,7 +81,7 @@ public: std::size_t getNumPoints() const override; - virtual std::unique_ptr getPointN(std::size_t n) const; + std::unique_ptr getPointN(std::size_t n) const override; /// \brief /// Return the start point of the LineString diff --git a/src/geom/CompoundCurve.cpp b/src/geom/CompoundCurve.cpp index d2e268f9b..70916aa9c 100644 --- a/src/geom/CompoundCurve.cpp +++ b/src/geom/CompoundCurve.cpp @@ -397,6 +397,22 @@ CompoundCurve::normalizeClosed() curves = std::move(newCurves); } +std::unique_ptr +CompoundCurve::getPointN(std::size_t n) const +{ + for (const auto& curve : curves) { + if (n < curve->getNumPoints()) { + return curve->getCoordinatesRO()->applyAt(n, [this](const auto& c) { + return getFactory()->createPoint(c); + }); + } + + n -= curve->getNumPoints(); + } + + return nullptr; +} + std::unique_ptr CompoundCurve::reverse() const { diff --git a/tests/unit/geom/CompoundCurveTest.cpp b/tests/unit/geom/CompoundCurveTest.cpp index ac33abade..c7def3e63 100644 --- a/tests/unit/geom/CompoundCurveTest.cpp +++ b/tests/unit/geom/CompoundCurveTest.cpp @@ -83,6 +83,7 @@ void object::test<1>() ensure("getStartPoint", cc->getStartPoint() == nullptr); ensure("getEndPoint", cc->getEndPoint() == nullptr); + ensure("getPointN", cc->getPointN(3) == nullptr); } // Basic Geometry API @@ -101,7 +102,7 @@ void object::test<2>() ensure_equals("getLength", cc_->getLength(), geos::MATH_PI + 2); ensure_equals("getNumGeometries", cc_->getNumGeometries(), 1u); ensure_equals("getNumCurves", cc_->getNumCurves(), 2u); - ensure_equals("getNumPoints", cc_->getNumPoints(), 5u); // FIXME should this be 5 or 4? + ensure_equals("getNumPoints", cc_->getNumPoints(), 5u); geos::geom::Envelope expected(0, 2, 0, 2); ensure("getEnvelopeInternal", cc_->getEnvelopeInternal()->equals(&expected)); @@ -130,6 +131,7 @@ void object::test<2>() ensure_equals_geometry(cc_->getStartPoint().get(), factory_->createPoint(CoordinateXY{0, 0}).get()); ensure_equals_geometry(cc_->getEndPoint().get(), factory_->createPoint(CoordinateXY{2, 2}).get()); + ensure_equals_geometry(cc_->getPointN(4).get(), factory_->createPoint(CoordinateXY{2, 2}).get()); } // Operations commit b040a784c29565807d660067b45df300216137b1 Author: Daniel Baston Date: Wed Mar 11 12:01:02 2026 -0400 GEOSGeom_getExtent: Update docs/tests for curves diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 12d30c9f4..47bbd44d2 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3186,7 +3186,12 @@ extern int GEOS_DLL GEOSGeom_getCoordinateDimension( const GEOSGeometry* g); /** -* Finds the minimum X value in the geometry. +* Gets the minimum X value of the geometry's envelope. +* For linear geometry types, this is the same as the minimum X +* coordinate value. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[out] value Pointer to place result * \return 0 on exception @@ -3196,7 +3201,12 @@ extern int GEOS_DLL GEOSGeom_getCoordinateDimension( extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value); /** -* Finds the minimum Y value in the geometry. +* Gets the minimum Y value of the geometry's envelope. +* For linear geometry types, this is the same as the minimum Y +* coordinate value. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[out] value Pointer to place result * \return 0 on exception @@ -3206,7 +3216,12 @@ extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value); extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value); /** -* Finds the maximum X value in the geometry. +* Get the maximum X value of the geometry's envelope. +* For linear geometry types, this is the same as the maximum X +* coordinate value. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[out] value Pointer to place result * \return 0 on exception @@ -3216,7 +3231,12 @@ extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value); extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value); /** -* Finds the maximum Y value in the geometry. +* Gets the maximum Y value of the geometry's envelope. +* For linear geometry types, this is the same as the maximum Y +* coordinate value. +* +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[out] value Pointer to place result * \return 0 on exception @@ -3226,9 +3246,13 @@ extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value); extern int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value); /** -* Finds the extent (minimum and maximum X and Y value) of the geometry. +* Finds the extent (minimum and maximum X and Y value) of the +* geometry's envelope. +* * Raises an exception for empty geometry input. * +* Curved geometry types are supported since GEOS 3.13. +* * \param[in] g Input geometry * \param[out] xmin Pointer to place result for minimum X value * \param[out] ymin Pointer to place result for minimum Y value diff --git a/tests/unit/capi/GEOSGeom_extentTest.cpp b/tests/unit/capi/GEOSGeom_extentTest.cpp index 49a703c5e..a722b5903 100644 --- a/tests/unit/capi/GEOSGeom_extentTest.cpp +++ b/tests/unit/capi/GEOSGeom_extentTest.cpp @@ -56,5 +56,37 @@ void object::test<2>() ensure_equals(GEOSGeom_getExtent(geom1_, &d, &d, &d, &d), 0); } +template<> +template<> +void object::test<3>() +{ + set_test_name("curved inputs"); + + input_ = fromWKT("CIRCULARSTRING (-5 0, 4 3, 0 -5)"); + + { + double xmin, ymin, xmax, ymax = -1; + ensure_equals(GEOSGeom_getXMin(input_, &xmin), 1); + ensure_equals(GEOSGeom_getXMax(input_, &xmax), 1); + ensure_equals(GEOSGeom_getYMin(input_, &ymin), 1); + ensure_equals(GEOSGeom_getYMax(input_, &ymax), 1); + + ensure_equals(xmin, -5); + ensure_equals(xmax, 5); + ensure_equals(ymin, -5); + ensure_equals(ymax, 5); + } + + { + double xmin, ymin, xmax, ymax = -1; + + ensure_equals(GEOSGeom_getExtent(input_, &xmin, &ymin, &xmax, &ymax), 1); + ensure_equals(xmin, -5); + ensure_equals(xmax, 5); + ensure_equals(ymin, -5); + ensure_equals(ymax, 5); + } +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 140 ++++++++++++++----- capi/geos_ts_c.cpp | 35 ++--- include/geos/geom/CompoundCurve.h | 2 + include/geos/geom/Curve.h | 7 +- include/geos/geom/SimpleCurve.h | 2 +- include/geos/precision/GeometryPrecisionReducer.h | 2 +- .../PointwisePrecisionReducerTransformer.h | 2 +- .../geos/precision/PrecisionReducerTransformer.h | 4 +- src/geom/CompoundCurve.cpp | 16 +++ .../PointwisePrecisionReducerTransformer.cpp | 8 +- src/precision/PrecisionReducerTransformer.cpp | 2 +- tests/unit/capi/GEOSCircularStringTest.cpp | 149 +++++++++++++++++++++ tests/unit/capi/GEOSCompoundCurveTest.cpp | 145 ++++++++++++++++++++ tests/unit/capi/GEOSGeom_extentTest.cpp | 32 +++++ tests/unit/capi/capi_test_utils.h | 2 +- tests/unit/geom/CompoundCurveTest.cpp | 4 +- .../precision/GeometryPrecisionReducerTest.cpp | 31 ++++- 17 files changed, 522 insertions(+), 61 deletions(-) create mode 100644 tests/unit/capi/GEOSCircularStringTest.cpp create mode 100644 tests/unit/capi/GEOSCompoundCurveTest.cpp hooks/post-receive -- GEOS From git at osgeo.org Fri Mar 20 12:41:15 2026 From: git at osgeo.org (git at osgeo.org) Date: Fri, 20 Mar 2026 12:41:15 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 09463aeb954524fb11318e1d9934e37b563ddf4b Message-ID: <20260320194116.1A7D81C69F5@trac.osgeo.org> 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 09463aeb954524fb11318e1d9934e37b563ddf4b (commit) via a4fd2b4bd05a868fb19791cb9dcb0135857a5797 (commit) from f1c154d67d6f0a71e76b7ced2f014d74b4f64b19 (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 09463aeb954524fb11318e1d9934e37b563ddf4b Author: Daniel Baston Date: Mon Mar 9 18:16:58 2026 -0400 geos_unit: handle (Curve)Polygons in ensure_equals_exact_geometry diff --git a/tests/unit/utility.h b/tests/unit/utility.h index bdd50cfcc..21825988b 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -540,17 +540,19 @@ template inline void ensure_equals_exact_geometry(const T *lhs_in, template <> inline void ensure_equals_exact_geometry(const geos::geom::Geometry *lhs_in, - const geos::geom::Geometry *rhs_in, - double tolerance) + const geos::geom::Geometry *rhs_in, + double tolerance) { assert(nullptr != lhs_in); assert(nullptr != rhs_in); using geos::geom::CoordinateSequence; + using geos::geom::Curve; using geos::geom::GeometryCollection; using geos::geom::Point; using geos::geom::Polygon; using geos::geom::SimpleCurve; + using geos::geom::Surface; ensure_equals("type id do not match", lhs_in->getGeometryTypeId(), rhs_in->getGeometryTypeId()); @@ -563,6 +565,23 @@ ensure_equals_exact_geometry(const geos::geom::Geometry *lhs_in, const SimpleCurve *gln2 = static_cast(rhs_in); return ensure_equals_dims( gln1->getCoordinatesRO(), gln2->getCoordinatesRO(), 2, tolerance); } + else if (const Surface* gply1 = dynamic_cast(lhs_in)) { + const Surface* gply2 = static_cast(rhs_in); + const Geometry* extRing1 = gply1->getExteriorRing(); + const Geometry* extRing2 = gply2->getExteriorRing(); + + ensure_equals_exact_geometry(extRing1, extRing2, tolerance); + + ensure_equals("number of holes does not match", + gply1->getNumInteriorRing(), + gply2->getNumInteriorRing()); + + for (std::size_t i = 0; i < gply1->getNumInteriorRing(); i++) { + ensure_equals_exact_geometry(static_cast(gply1->getInteriorRingN(i)), + static_cast(gply2->getInteriorRingN(i)), + tolerance); + } + } else if (const GeometryCollection* gc1 = dynamic_cast(lhs_in)) { const GeometryCollection *gc2 = static_cast(rhs_in); for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { commit a4fd2b4bd05a868fb19791cb9dcb0135857a5797 Author: Daniel Baston Date: Fri Jan 30 13:30:14 2026 -0500 geos_unit: use specified tolerance for Z/M in ensure_equals_exact_geometry_xyzm diff --git a/tests/unit/utility.h b/tests/unit/utility.h index 7736d6de6..bdd50cfcc 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -177,13 +177,13 @@ ensure_equals_xyzm(geos::geom::CoordinateXYZM const& actual, } } -inline void ensure_same(const char* msg, double a, double b) +inline void ensure_same(const char* msg, double a, double b, double tol = std::numeric_limits::epsilon()) { if (std::isnan(a) && std::isnan(b)) { return; } - ensure_equals(msg, a, b); + ensure_equals(msg, a, b, tol); } inline void ensure_same(double a, double b) @@ -431,8 +431,8 @@ ensure_equals_exact_xyzm(const geos::geom::CoordinateSequence* seq1, seq2->getAt(i, c2); ensure("xy not in tolerance", c1.distance(c2) <= tol); - ensure_same(("index " + std::to_string(i) + "/" + std::to_string(seq1->getSize() - 1) + " z not same").c_str(), c1.z, c2.z); - ensure_same(("index " + std::to_string(i) + "/" + std::to_string(seq1->getSize() - 1) + " m not same").c_str(), c1.m, c2.m); + ensure_same(("index " + std::to_string(i) + "/" + std::to_string(seq1->getSize() - 1) + " z not same").c_str(), c1.z, c2.z, tol); + ensure_same(("index " + std::to_string(i) + "/" + std::to_string(seq1->getSize() - 1) + " m not same").c_str(), c1.m, c2.m, tol); } } ----------------------------------------------------------------------- Summary of changes: tests/unit/utility.h | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Fri Mar 20 12:42:15 2026 From: git at osgeo.org (git at osgeo.org) Date: Fri, 20 Mar 2026 12:42:15 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 1c6865422740045de3521cae0622a15ec470f4d2 Message-ID: <20260320194215.886E9CE84@trac.osgeo.org> 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 1c6865422740045de3521cae0622a15ec470f4d2 (commit) from 09463aeb954524fb11318e1d9934e37b563ddf4b (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 1c6865422740045de3521cae0622a15ec470f4d2 Author: Daniel Baston Date: Tue Dec 23 10:49:36 2025 -0500 CircularArc: make center and radius calculation orientation-independent diff --git a/include/geos/geom/CircularArc.h b/include/geos/geom/CircularArc.h index 067e5ba39..de75334fc 100644 --- a/include/geos/geom/CircularArc.h +++ b/include/geos/geom/CircularArc.h @@ -86,7 +86,11 @@ public: /// Return the center point of the circle associated with this arc const CoordinateXY& getCenter() const { if (!m_center_known) { - m_center = algorithm::CircularArcs::getCenter(p0(), p1(), p2()); + if (isCCW()) { + m_center = algorithm::CircularArcs::getCenter(p0(), p1(), p2()); + } else { + m_center = algorithm::CircularArcs::getCenter(p2(), p1(), p0()); + } m_center_known = true; } @@ -121,7 +125,11 @@ public: /// Return the radius of the circle associated with this arc double getRadius() const { if (!m_radius_known) { - m_radius = getCenter().distance(p0()); + if (isCCW()) { + m_radius = getCenter().distance(p0()); + } else { + m_radius = getCenter().distance(p2()); + } m_radius_known = true; } diff --git a/tests/unit/geom/CircularArcTest.cpp b/tests/unit/geom/CircularArcTest.cpp index d09c9ae5b..67df5734a 100644 --- a/tests/unit/geom/CircularArcTest.cpp +++ b/tests/unit/geom/CircularArcTest.cpp @@ -1,11 +1,15 @@ #include +#include #include #include #include using geos::geom::CoordinateXY; +using geos::geom::CoordinateXYZM; using geos::geom::CircularArc; +using geos::geom::CoordinateSequence; + using geos::MATH_PI; namespace tut { @@ -31,6 +35,9 @@ struct test_circulararc_data { auto rev = CircularArc::create(p2, p1, p0); ensure_equals(p2.toString() + " / " + p1.toString() + " / " + p0.toString(), rev.getLength(), expected, eps); } + + + }; using group = test_group; @@ -123,4 +130,22 @@ void object::test<5>() CircularArc::create(CoordinateXY{-5, 0}, {0, 5}, {5, 0}).containsPointOnCircle({5, 0}); } +template<> +template<> +void object::test<6>() { + set_test_name("getRadius and getCenter are order-independent"); + using XY = CoordinateXY; + + CircularArc arc1 = CircularArc::create(XY{71.96, -65.54}, XY{22.2, -18.52}, XY{20, 50}); + double r1 = arc1.getRadius(); + CoordinateXY c1 = arc1.getCenter(); + + CircularArc arc2 = CircularArc::create(XY{20, 50}, XY{22.2, -18.52}, XY{71.96, -65.54}); + double r2 = arc1.getRadius(); + CoordinateXY c2 = arc1.getCenter(); + + ensure_equals(r1, r2); + ensure_equals(c1, c2); +} + } ----------------------------------------------------------------------- Summary of changes: include/geos/geom/CircularArc.h | 12 ++++++++++-- tests/unit/geom/CircularArcTest.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Fri Mar 20 14:35:57 2026 From: git at osgeo.org (git at osgeo.org) Date: Fri, 20 Mar 2026 14:35:57 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 43b00bd6babaab57b3c48c0699e9e0f2e36e04db Message-ID: <20260320213601.22577CF60@trac.osgeo.org> 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 43b00bd6babaab57b3c48c0699e9e0f2e36e04db (commit) via 68129fd3360a0c5b6ccbd058a058a0db6b7f076a (commit) from 1c6865422740045de3521cae0622a15ec470f4d2 (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 43b00bd6babaab57b3c48c0699e9e0f2e36e04db Author: Paul Ramsey Date: Fri Mar 20 14:22:01 2026 -0700 Use func(void) in CAPI func definition sites too, in following clang warning defined modern practice, references #1404 diff --git a/capi/geos_c.cpp b/capi/geos_c.cpp index 9a832a64b..e74070e3e 100644 --- a/capi/geos_c.cpp +++ b/capi/geos_c.cpp @@ -122,7 +122,7 @@ extern "C" { } void - finishGEOS() + finishGEOS(void) { if(handle != NULL) { finishGEOS_r(handle); @@ -137,13 +137,13 @@ extern "C" { } void - GEOS_interruptRequest() + GEOS_interruptRequest(void) { geos::util::Interrupt::request(); } void - GEOS_interruptCancel() + GEOS_interruptCancel(void) { geos::util::Interrupt::cancel(); } @@ -1011,7 +1011,7 @@ extern "C" { } GEOSMakeValidParams* - GEOSMakeValidParams_create() + GEOSMakeValidParams_create(void) { return GEOSMakeValidParams_create_r(handle); } @@ -1047,7 +1047,7 @@ extern "C" { } GEOSCoverageCleanParams* - GEOSCoverageCleanParams_create() + GEOSCoverageCleanParams_create(void) { return GEOSCoverageCleanParams_create_r(handle); } @@ -1169,7 +1169,7 @@ extern "C" { } int - GEOS_getWKBOutputDims() + GEOS_getWKBOutputDims(void) { return GEOS_getWKBOutputDims_r(handle); } @@ -1181,7 +1181,7 @@ extern "C" { } int - GEOS_getWKBByteOrder() + GEOS_getWKBByteOrder(void) { return GEOS_getWKBByteOrder_r(handle); } @@ -1478,7 +1478,7 @@ extern "C" { /* WKT Reader */ WKTReader* - GEOSWKTReader_create() + GEOSWKTReader_create(void) { return GEOSWKTReader_create_r(handle); } @@ -1503,7 +1503,7 @@ extern "C" { /* WKT Writer */ WKTWriter* - GEOSWKTWriter_create() + GEOSWKTWriter_create(void) { return GEOSWKTWriter_create_r(handle); } @@ -1552,7 +1552,7 @@ extern "C" { /* WKB Reader */ WKBReader* - GEOSWKBReader_create() + GEOSWKBReader_create(void) { return GEOSWKBReader_create_r(handle); } @@ -1583,7 +1583,7 @@ extern "C" { /* WKB Writer */ WKBWriter* - GEOSWKBWriter_create() + GEOSWKBWriter_create(void) { return GEOSWKBWriter_create_r(handle); } @@ -1664,7 +1664,7 @@ extern "C" { /* GeoJSON Reader */ GeoJSONReader* - GEOSGeoJSONReader_create() + GEOSGeoJSONReader_create(void) { return GEOSGeoJSONReader_create_r(handle); } @@ -1683,7 +1683,7 @@ extern "C" { /* GeoJSON Writer */ GeoJSONWriter* - GEOSGeoJSONWriter_create() + GEOSGeoJSONWriter_create(void) { return GEOSGeoJSONWriter_create_r(handle); } @@ -1939,37 +1939,37 @@ extern "C" { } geos::geom::Geometry* - GEOSGeom_createEmptyPoint() + GEOSGeom_createEmptyPoint(void) { return GEOSGeom_createEmptyPoint_r(handle); } geos::geom::Geometry* - GEOSGeom_createEmptyLineString() + GEOSGeom_createEmptyLineString(void) { return GEOSGeom_createEmptyLineString_r(handle); } geos::geom::Geometry* - GEOSGeom_createEmptyPolygon() + GEOSGeom_createEmptyPolygon(void) { return GEOSGeom_createEmptyPolygon_r(handle); } geos::geom::Geometry* - GEOSGeom_createEmptyCircularString() + GEOSGeom_createEmptyCircularString(void) { return GEOSGeom_createEmptyCircularString_r(handle); } geos::geom::Geometry* - GEOSGeom_createEmptyCompoundCurve() + GEOSGeom_createEmptyCompoundCurve(void) { return GEOSGeom_createEmptyCompoundCurve_r(handle); } geos::geom::Geometry* - GEOSGeom_createEmptyCurvePolygon() + GEOSGeom_createEmptyCurvePolygon(void) { return GEOSGeom_createEmptyCurvePolygon_r(handle); } @@ -2001,7 +2001,7 @@ extern "C" { } GEOSBufferParams* - GEOSBufferParams_create() + GEOSBufferParams_create(void) { return GEOSBufferParams_create_r(handle); } commit 68129fd3360a0c5b6ccbd058a058a0db6b7f076a Author: Paul Ramsey Date: Fri Mar 20 13:24:17 2026 -0700 Remove use of () in C prototypes with no parameters in favour of using func(void), quiets clang warnings in newer clang. References #1404 diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 630f1763f..635bfff64 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -2834,7 +2834,7 @@ extern GEOSGeometry GEOS_DLL *GEOSGeom_createCircularString(GEOSCoordSequence* s * Caller is responsible for freeing with GEOSGeom_destroy(). * \since 3.13 */ -extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCircularString(); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCircularString(void); /** * Creates a CompoundCurve geometry. @@ -2853,7 +2853,7 @@ extern GEOSGeometry GEOS_DLL *GEOSGeom_createCompoundCurve(GEOSGeometry** curves * Caller is responsible for freeing with GEOSGeom_destroy(). * \since 3.13 */ -extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCompoundCurve(); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCompoundCurve(void); /** * Creates a CurvePolygon geometry from ring geometries. @@ -2879,7 +2879,7 @@ extern GEOSGeometry GEOS_DLL *GEOSGeom_createCurvePolygon( * Caller is responsible for freeing with GEOSGeom_destroy(). * \since 3.13 */ -extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCurvePolygon(); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCurvePolygon(void); /** * Create a geometry collection. @@ -4638,7 +4638,7 @@ extern GEOSGeometry GEOS_DLL * GEOSCoverageSimplifyVW( * \since 3.14 */ extern GEOSCoverageCleanParams GEOS_DLL * -GEOSCoverageCleanParams_create(); +GEOSCoverageCleanParams_create(void); /** * Destroy a GEOSCoverageCleanParams and free all associated memory. ----------------------------------------------------------------------- Summary of changes: capi/geos_c.cpp | 40 ++++++++++++++++++++-------------------- capi/geos_c.h.in | 8 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 22 17:05:08 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 22 Mar 2026 17:05:08 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.14 updated. a2e484ca26a8c2a896452f0d8247c4b83e08f4e2 Message-ID: <20260323000509.58B1421318@trac.osgeo.org> 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, 3.14 has been updated via a2e484ca26a8c2a896452f0d8247c4b83e08f4e2 (commit) from 2b48c043c11a15beb8d2e0ca4efe004be171bd42 (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 a2e484ca26a8c2a896452f0d8247c4b83e08f4e2 Author: Mike Taves Date: Mon Mar 23 13:04:29 2026 +1300 CI: update various GitHub Actions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1741a25f..735dbddbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,10 +189,10 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -221,7 +221,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -243,7 +243,7 @@ jobs: - name: 'Upload Valgrind Log' if: failure() - uses: actions/upload-artifact at v4 + uses: actions/upload-artifact at v7 with: name: valgrind-log path: build/Testing/Temporary/MemoryChecker.**.log @@ -276,7 +276,7 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -291,7 +291,7 @@ jobs: - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: windows-mingw-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }} @@ -313,7 +313,7 @@ jobs: ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -327,7 +327,7 @@ jobs: runs-on: windows-2022 steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 # ccache not supported for this generator and/or Debug @@ -367,11 +367,11 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: msvc-ninja-${{ matrix.ci.os }}-${{ matrix.ci.cxxstd }}-${{ matrix.ci.arch }}-${{ github.ref_name }}-${{ github.run_id }} @@ -406,7 +406,7 @@ jobs: ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -447,11 +447,11 @@ jobs: clang++ --version - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: ${{ runner.os }}-${{ matrix.xcode }}-${{ matrix.build_type}}-${{ matrix.cxxstd }}-${{ github.ref_name }}-${{ github.run_id }} @@ -472,7 +472,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -492,10 +492,10 @@ jobs: sudo -E apt-get autopurge -y needrestart sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make cmake emscripten ccache - - uses: actions/checkout at v5 + - uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -516,7 +516,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -537,7 +537,7 @@ jobs: python3 -m pip install --disable-pip-version-check --user codespell - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'cppcheck' run: ./tools/cppcheck.sh @@ -561,7 +561,7 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 with: path: geos diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 556a2143e..a99e32536 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -37,11 +37,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout at v4 + uses: actions/checkout at v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init at v3 + uses: github/codeql-action/init at v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -64,6 +64,6 @@ jobs: make -j$(nproc) - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze at v3 + uses: github/codeql-action/analyze at v4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 0505fd9e1..4bace6fd6 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -23,13 +23,13 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v2 + uses: docker/setup-buildx-action at v4 - name: Login to GitHub Container Registry - uses: docker/login-action at v2 + uses: docker/login-action at v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -40,7 +40,7 @@ jobs: cp tools/ci/geosop/Dockerfile . - name: Build and Push - uses: docker/build-push-action at v4 + uses: docker/build-push-action at v7 with: context: . # platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cd89dd4e..afdb1878a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Get tag id: tag @@ -68,7 +68,7 @@ jobs: - name: Create Release if: ${{ steps.tag.outputs.tag == steps.version.outputs.geosversion }} id: create_release - uses: softprops/action-gh-release at v1 + uses: softprops/action-gh-release at v2 with: body_path: ${{ steps.notes.outputs.geosnotes }} name: Release ${{ steps.version.outputs.geosversion }} diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 7a14b534c..c059e4210 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -27,7 +27,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out ?' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Hugo Build ?' # ...or replace 'master' with a full version tag, such as: v0.64.1 @@ -51,7 +51,7 @@ jobs: cp -ra build.cmake/doxygen/doxygen_docs/html/* public_html/doxygen - name: 'Deploy ?' - uses: JamesIves/github-pages-deploy-action at v4.4.1 + uses: JamesIves/github-pages-deploy-action at v4 with: branch: gh-pages # The branch the action should deploy to. folder: public_html # The folder the action should deploy. ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 38 +++++++++++++++++++------------------- .github/workflows/codeql.yml | 6 +++--- .github/workflows/container.yml | 8 ++++---- .github/workflows/release.yml | 4 ++-- .github/workflows/web.yml | 4 ++-- 5 files changed, 30 insertions(+), 30 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 22 17:30:17 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 22 Mar 2026 17:30:17 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.13 updated. 938dcf7d376144e8cdcde79a424feabff94ea413 Message-ID: <20260323003017.3AB5220CAB@trac.osgeo.org> 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, 3.13 has been updated via 938dcf7d376144e8cdcde79a424feabff94ea413 (commit) from 2bf492cf2c9915663f08f3fc7e7e7b3aef45f6d6 (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 938dcf7d376144e8cdcde79a424feabff94ea413 Author: Mike Taves Date: Mon Mar 23 13:08:33 2026 +1300 CI: update various GitHub Actions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index deea2b503..7d88e428b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,10 +149,10 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -181,7 +181,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -203,7 +203,7 @@ jobs: - name: 'Upload Valgrind Log' if: failure() - uses: actions/upload-artifact at v4 + uses: actions/upload-artifact at v7 with: name: valgrind-log path: build/Testing/Temporary/MemoryChecker.**.log @@ -229,7 +229,7 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -244,7 +244,7 @@ jobs: - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: windows-mingw-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }} @@ -266,7 +266,7 @@ jobs: ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -280,7 +280,7 @@ jobs: runs-on: windows-2022 steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 # ccache not supported for this generator and/or Debug @@ -321,11 +321,11 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: msvc-ninja-${{ matrix.ci.os }}-${{ matrix.ci.cxxstd }}-${{ matrix.ci.arch }}-${{ github.ref_name }}-${{ github.run_id }} @@ -360,7 +360,7 @@ jobs: ccache --show-stats --verbose - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -401,11 +401,11 @@ jobs: clang++ --version - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: ${{ runner.os }}-${{ matrix.xcode }}-${{ matrix.build_type}}-${{ matrix.cxxstd }}-${{ github.ref_name }}-${{ github.run_id }} @@ -426,7 +426,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -435,7 +435,6 @@ jobs: working-directory: ./build run: ctest -V --output-on-failure -C ${{ matrix.build_type }} - code-quality: name: Code quality checks runs-on: ubuntu-latest @@ -448,7 +447,7 @@ jobs: python3 -m pip install --disable-pip-version-check --user codespell - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'cppcheck' run: ./tools/cppcheck.sh @@ -472,7 +471,7 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 with: path: geos diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 556a2143e..a99e32536 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -37,11 +37,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout at v4 + uses: actions/checkout at v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init at v3 + uses: github/codeql-action/init at v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -64,6 +64,6 @@ jobs: make -j$(nproc) - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze at v3 + uses: github/codeql-action/analyze at v4 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 0505fd9e1..4bace6fd6 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -23,13 +23,13 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v2 + uses: docker/setup-buildx-action at v4 - name: Login to GitHub Container Registry - uses: docker/login-action at v2 + uses: docker/login-action at v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -40,7 +40,7 @@ jobs: cp tools/ci/geosop/Dockerfile . - name: Build and Push - uses: docker/build-push-action at v4 + uses: docker/build-push-action at v7 with: context: . # platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a268cef6a..845d021a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Get tag id: tag @@ -68,7 +68,7 @@ jobs: - name: Create Release if: ${{ steps.tag.outputs.tag == steps.version.outputs.geosversion }} id: create_release - uses: softprops/action-gh-release at v1 + uses: softprops/action-gh-release at v2 with: body_path: ${{ steps.notes.outputs.geosnotes }} name: Release ${{ steps.version.outputs.geosversion }} diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 4bcc1306c..c059e4210 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -27,11 +27,11 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out ?' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Hugo Build ?' # ...or replace 'master' with a full version tag, such as: v0.64.1 - uses: jakejarvis/hugo-build-action at v0.88.1 + uses: jakejarvis/hugo-build-action at v0.111.3 with: args: --source web --destination public --verbose @@ -51,7 +51,7 @@ jobs: cp -ra build.cmake/doxygen/doxygen_docs/html/* public_html/doxygen - name: 'Deploy ?' - uses: JamesIves/github-pages-deploy-action at v4.4.1 + uses: JamesIves/github-pages-deploy-action at v4 with: branch: gh-pages # The branch the action should deploy to. folder: public_html # The folder the action should deploy. ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 33 ++++++++++++++++----------------- .github/workflows/codeql.yml | 6 +++--- .github/workflows/container.yml | 8 ++++---- .github/workflows/release.yml | 4 ++-- .github/workflows/web.yml | 6 +++--- 5 files changed, 28 insertions(+), 29 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 22 17:51:35 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 22 Mar 2026 17:51:35 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.12 updated. 19857cafbc79e8e9d35154ff1b709ab5d61e14ae Message-ID: <20260323005135.D761D21567@trac.osgeo.org> 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, 3.12 has been updated via 19857cafbc79e8e9d35154ff1b709ab5d61e14ae (commit) from 3802326b4d063a41550d9fe411d891cdd52e68bc (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 19857cafbc79e8e9d35154ff1b709ab5d61e14ae Author: Mike Taves Date: Mon Mar 23 13:47:26 2026 +1300 CI: update various GitHub Actions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4408f33a7..5c4b961e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,10 +148,10 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 id: restore-cache with: path: .ccache @@ -179,7 +179,7 @@ jobs: ccache -s - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -204,7 +204,7 @@ jobs: - name: 'Upload Valgrind Log' if: failure() - uses: actions/upload-artifact at v4 + uses: actions/upload-artifact at v7 with: name: valgrind-log path: build.cmake/Testing/Temporary/MemoryChecker.**.log @@ -229,7 +229,7 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -239,7 +239,7 @@ jobs: - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: windows-mingw-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }} @@ -258,7 +258,7 @@ jobs: cmake --build . -j 2 - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -284,14 +284,14 @@ jobs: runs-on: ${{ matrix.ci.os }} steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' run: choco install ccache - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: windows-msvc-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }} @@ -306,7 +306,7 @@ jobs: cmake --build . --config ${{ matrix.ci.build_type }} -j 2 - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -348,11 +348,11 @@ jobs: clang++ --version - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Retrieve build cache id: restore-cache - uses: actions/cache/restore at v4 + uses: actions/cache/restore at v5 with: path: .ccache key: ${{ runner.os }}-${{ matrix.xcode }}-${{ matrix.build_type}}-${{ matrix.cxxstd }}-${{ github.ref_name }}-${{ github.run_id }} @@ -373,7 +373,7 @@ jobs: ccache --show-stats - name: Save build cache - uses: actions/cache/save at v4 + uses: actions/cache/save at v5 with: path: .ccache key: ${{ steps.restore-cache.outputs.cache-primary-key }} @@ -383,7 +383,6 @@ jobs: cd build ctest -V --output-on-failure -C ${{ matrix.build_type }} - code-quality: name: Code quality checks runs-on: ubuntu-latest @@ -395,7 +394,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install cppcheck - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'cppcheck' run: | diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 0505fd9e1..4bace6fd6 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -23,13 +23,13 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v2 + uses: docker/setup-buildx-action at v4 - name: Login to GitHub Container Registry - uses: docker/login-action at v2 + uses: docker/login-action at v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -40,7 +40,7 @@ jobs: cp tools/ci/geosop/Dockerfile . - name: Build and Push - uses: docker/build-push-action at v4 + uses: docker/build-push-action at v7 with: context: . # platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cd89dd4e..afdb1878a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Get tag id: tag @@ -68,7 +68,7 @@ jobs: - name: Create Release if: ${{ steps.tag.outputs.tag == steps.version.outputs.geosversion }} id: create_release - uses: softprops/action-gh-release at v1 + uses: softprops/action-gh-release at v2 with: body_path: ${{ steps.notes.outputs.geosnotes }} name: Release ${{ steps.version.outputs.geosversion }} diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 4bcc1306c..c059e4210 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -27,11 +27,11 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out ?' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Hugo Build ?' # ...or replace 'master' with a full version tag, such as: v0.64.1 - uses: jakejarvis/hugo-build-action at v0.88.1 + uses: jakejarvis/hugo-build-action at v0.111.3 with: args: --source web --destination public --verbose @@ -51,7 +51,7 @@ jobs: cp -ra build.cmake/doxygen/doxygen_docs/html/* public_html/doxygen - name: 'Deploy ?' - uses: JamesIves/github-pages-deploy-action at v4.4.1 + uses: JamesIves/github-pages-deploy-action at v4 with: branch: gh-pages # The branch the action should deploy to. folder: public_html # The folder the action should deploy. ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 29 ++++++++++++++--------------- .github/workflows/container.yml | 8 ++++---- .github/workflows/release.yml | 4 ++-- .github/workflows/web.yml | 6 +++--- 4 files changed, 23 insertions(+), 24 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 22 18:09:46 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 22 Mar 2026 18:09:46 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.11 updated. b3e1169efeb6eb02f9f442bb66226f24d346b83a Message-ID: <20260323010946.EED662158A@trac.osgeo.org> 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, 3.11 has been updated via b3e1169efeb6eb02f9f442bb66226f24d346b83a (commit) from 63930d5392860983292b421b258cbbba530191ac (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 b3e1169efeb6eb02f9f442bb66226f24d346b83a Author: Mike Taves Date: Mon Mar 23 14:02:42 2026 +1300 CI: update various GitHub Actions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b02fca152..4e71e5006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,7 +89,7 @@ jobs: echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Build' env: @@ -124,7 +124,7 @@ jobs: - name: 'Upload Valgrind Log' if: failure() - uses: actions/upload-artifact at v4 + uses: actions/upload-artifact at v7 with: name: valgrind-log path: build.cmake/Testing/Temporary/MemoryChecker.**.log @@ -145,7 +145,7 @@ jobs: shell: msys2 {0} steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -174,7 +174,7 @@ jobs: shell: msys2 {0} steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Setup' uses: msys2/setup-msys2 at v2 @@ -200,7 +200,7 @@ jobs: runs-on: windows-2022 steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Build' run: | @@ -220,7 +220,7 @@ jobs: runs-on: windows-2025 steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Build' run: | diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 9c894ff9d..4908fc127 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -22,13 +22,13 @@ jobs: steps: - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v2 + uses: docker/setup-buildx-action at v4 - name: Login to GitHub Container Registry - uses: docker/login-action at v2 + uses: docker/login-action at v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -40,7 +40,7 @@ jobs: - name: Build and Push if: ${{ github.repository == 'libgeos/geos' }} }} - uses: docker/build-push-action at v4 + uses: docker/build-push-action at v7 with: context: . # platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cd89dd4e..afdb1878a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: Get tag id: tag @@ -68,7 +68,7 @@ jobs: - name: Create Release if: ${{ steps.tag.outputs.tag == steps.version.outputs.geosversion }} id: create_release - uses: softprops/action-gh-release at v1 + uses: softprops/action-gh-release at v2 with: body_path: ${{ steps.notes.outputs.geosnotes }} name: Release ${{ steps.version.outputs.geosversion }} diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 85cc3d6b9..fe92f164d 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -26,11 +26,11 @@ jobs: sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen - name: 'Check Out ?' - uses: actions/checkout at v4 + uses: actions/checkout at v6 - name: 'Hugo Build ?' # ...or replace 'master' with a full version tag, such as: v0.64.1 - uses: jakejarvis/hugo-build-action at v0.88.1 + uses: jakejarvis/hugo-build-action at v0.111.3 with: args: --source web --destination public --verbose @@ -50,7 +50,7 @@ jobs: cp -ra build.cmake/doxygen/doxygen_docs/html/* public_html/doxygen - name: 'Deploy ?' - uses: JamesIves/github-pages-deploy-action at 4.1.5 + uses: JamesIves/github-pages-deploy-action at v4 with: branch: gh-pages # The branch the action should deploy to. folder: public_html # The folder the action should depl y. ----------------------------------------------------------------------- Summary of changes: .github/workflows/ci.yml | 12 ++++++------ .github/workflows/container.yml | 8 ++++---- .github/workflows/release.yml | 4 ++-- .github/workflows/web.yml | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Sun Mar 22 18:32:30 2026 From: git at osgeo.org (git at osgeo.org) Date: Sun, 22 Mar 2026 18:32:30 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 81ab2d7b01990811c3edb00f7407a20908dfe1cc Message-ID: <20260323013231.1CDA821749@trac.osgeo.org> 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 81ab2d7b01990811c3edb00f7407a20908dfe1cc (commit) from 43b00bd6babaab57b3c48c0699e9e0f2e36e04db (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 81ab2d7b01990811c3edb00f7407a20908dfe1cc Author: Mike Taves Date: Mon Mar 23 14:32:11 2026 +1300 Add dependabot to help maintain GitHub Actions (#1396) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..8ac6b8c49 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" ----------------------------------------------------------------------- Summary of changes: .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 09:14:17 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 09:14:17 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 77574b214701e0f2750b949e7f65cbdd49a4ce31 Message-ID: <20260324161422.24976350C1@trac.osgeo.org> 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 77574b214701e0f2750b949e7f65cbdd49a4ce31 (commit) from 81ab2d7b01990811c3edb00f7407a20908dfe1cc (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 77574b214701e0f2750b949e7f65cbdd49a4ce31 Author: Daniel Baston Date: Tue Mar 24 12:13:49 2026 -0400 RingClipper: Avoid dropping M values (#1407) diff --git a/include/geos/operation/overlayng/RingClipper.h b/include/geos/operation/overlayng/RingClipper.h index d8f6a186e..8bee13b31 100644 --- a/include/geos/operation/overlayng/RingClipper.h +++ b/include/geos/operation/overlayng/RingClipper.h @@ -61,6 +61,7 @@ namespace overlayng { // geos.operation.overlayng */ class GEOS_DLL RingClipper { using Coordinate = geos::geom::Coordinate; + using CoordinateXY = geos::geom::CoordinateXY; using CoordinateSequence = geos::geom::CoordinateSequence; using Envelope = geos::geom::Envelope; @@ -87,10 +88,10 @@ private: * with an edge of the clip box. * The segment must be known to intersect the edge. */ - void intersection(const Coordinate& a, const Coordinate& b, int edgeIndex, Coordinate& rsltPt) const; - double intersectionLineY(const Coordinate& a, const Coordinate& b, double y) const; - double intersectionLineX(const Coordinate& a, const Coordinate& b, double x) const; - bool isInsideEdge(const Coordinate& p, int edgeIndex) const; + void intersection(const CoordinateXY& a, const CoordinateXY& b, int edgeIndex, CoordinateXY& rsltPt) const; + static double intersectionLineY(const CoordinateXY& a, const CoordinateXY& b, double y); + static double intersectionLineX(const CoordinateXY& a, const CoordinateXY& b, double x); + bool isInsideEdge(const CoordinateXY& p, int edgeIndex) const; public: diff --git a/src/operation/overlayng/RingClipper.cpp b/src/operation/overlayng/RingClipper.cpp index cf108dd1e..2551990f8 100644 --- a/src/operation/overlayng/RingClipper.cpp +++ b/src/operation/overlayng/RingClipper.cpp @@ -15,6 +15,7 @@ #include using geos::geom::CoordinateSequence; +using geos::geom::CoordinateXYZM; namespace geos { // geos namespace operation { // geos.operation @@ -41,16 +42,16 @@ std::unique_ptr RingClipper::clipToBoxEdge(const CoordinateSequence* pts, int edgeIndex, bool closeRing) const { // TODO: is it possible to avoid copying array 4 times? - std::unique_ptr ptsClip(new CoordinateSequence()); + auto ptsClip = std::make_unique(0, pts->hasZ(), pts->hasM()); - Coordinate p0; + CoordinateXYZM p0; pts->getAt(pts->size() - 1, p0); for (std::size_t i = 0; i < pts->size(); i++) { - Coordinate p1; + CoordinateXYZM p1; pts->getAt(i, p1); if (isInsideEdge(p1, edgeIndex)) { if (!isInsideEdge(p0, edgeIndex)) { - Coordinate intPt; + CoordinateXY intPt; intersection(p0, p1, edgeIndex, intPt); ptsClip->add(intPt, false); } @@ -59,7 +60,7 @@ RingClipper::clipToBoxEdge(const CoordinateSequence* pts, int edgeIndex, bool cl } else if (isInsideEdge(p0, edgeIndex)) { - Coordinate intPt; + CoordinateXY intPt; intersection(p0, p1, edgeIndex, intPt); ptsClip->add(intPt, false); } @@ -69,28 +70,26 @@ RingClipper::clipToBoxEdge(const CoordinateSequence* pts, int edgeIndex, bool cl } // add closing point if required - if (closeRing && ptsClip->size() > 0) { - const Coordinate& start = ptsClip->getAt(0); - if (!start.equals2D(ptsClip->getAt(ptsClip->size() - 1))) { - ptsClip->add(start); - } + if (closeRing) { + ptsClip->closeRing(); } + return ptsClip; } /*private*/ void -RingClipper::intersection(const Coordinate& a, const Coordinate& b, int edgeIndex, Coordinate& rsltPt) const +RingClipper::intersection(const CoordinateXY& a, const CoordinateXY& b, int edgeIndex, CoordinateXY& rsltPt) const { switch (edgeIndex) { case BOX_BOTTOM: - rsltPt = Coordinate(intersectionLineY(a, b, clipEnv.getMinY()), clipEnv.getMinY()); + rsltPt = CoordinateXY(intersectionLineY(a, b, clipEnv.getMinY()), clipEnv.getMinY()); break; case BOX_RIGHT: - rsltPt = Coordinate(clipEnv.getMaxX(), intersectionLineX(a, b, clipEnv.getMaxX())); + rsltPt = CoordinateXY(clipEnv.getMaxX(), intersectionLineX(a, b, clipEnv.getMaxX())); break; case BOX_TOP: - rsltPt = Coordinate(intersectionLineY(a, b, clipEnv.getMaxY()), clipEnv.getMaxY()); + rsltPt = CoordinateXY(intersectionLineY(a, b, clipEnv.getMaxY()), clipEnv.getMaxY()); break; case BOX_LEFT: default: @@ -101,7 +100,7 @@ RingClipper::intersection(const Coordinate& a, const Coordinate& b, int edgeInde /*private*/ double -RingClipper::intersectionLineY(const Coordinate& a, const Coordinate& b, double y) const +RingClipper::intersectionLineY(const CoordinateXY& a, const CoordinateXY& b, double y) { double m = (b.x - a.x) / (b.y - a.y); double intercept = (y - a.y) * m; @@ -110,7 +109,7 @@ RingClipper::intersectionLineY(const Coordinate& a, const Coordinate& b, double /*private*/ double -RingClipper::intersectionLineX(const Coordinate& a, const Coordinate& b, double x) const +RingClipper::intersectionLineX(const CoordinateXY& a, const CoordinateXY& b, double x) { double m = (b.y - a.y) / (b.x - a.x); double intercept = (x - a.x) * m; @@ -119,7 +118,7 @@ RingClipper::intersectionLineX(const Coordinate& a, const Coordinate& b, double /*private*/ bool -RingClipper::isInsideEdge(const Coordinate& p, int edgeIndex) const +RingClipper::isInsideEdge(const CoordinateXY& p, int edgeIndex) const { if (clipEnv.isNull()) { return false; diff --git a/tests/unit/operation/overlayng/OverlayNGZTest.cpp b/tests/unit/operation/overlayng/OverlayNGZTest.cpp index e9ee46377..732d7eb25 100644 --- a/tests/unit/operation/overlayng/OverlayNGZTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGZTest.cpp @@ -316,4 +316,14 @@ void object::test<21>() "LINESTRING ZM (0 0 2 9, 1 0 5 7)"); } +template<> +template<> +void object::test<22> () +{ + set_test_name("POLYGON XYM / POLYGON XYM intersection"); + + checkIntersection("POLYGON M ((4 12 6, 2 6 7, 7 6 8, 11 4 9, 15 15 10, 4 12 6))", "POLYGON M ((1 9 1, 9 9 2, 9 1 3, 1 1 4, 1 9 1))", + "POLYGON M ((2 6 7, 3 9 3.875, 9 9 2, 9 5 5.5, 7 6 8, 2 6 7))"); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: include/geos/operation/overlayng/RingClipper.h | 9 ++++--- src/operation/overlayng/RingClipper.cpp | 33 +++++++++++------------ tests/unit/operation/overlayng/OverlayNGZTest.cpp | 10 +++++++ 3 files changed, 31 insertions(+), 21 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 09:21:55 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 09:21:55 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 5e4f5981551ec79836ac25bda4fce0b707187fc0 Message-ID: <20260324162155.D14003015D@trac.osgeo.org> 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 5e4f5981551ec79836ac25bda4fce0b707187fc0 (commit) via e5f11a9f5770ce2f537f0ab1962640077baf8d1a (commit) via a9efb9e0676d4626a995d36d9163d487dbe75579 (commit) via 617ef6afe71fd4c7fccb6820b0b3b622a2885b09 (commit) via 6f19fd5cca6755766820b1422bc89dbafa08482f (commit) via 1dbed71afb3a52f255e939774dfd2c6e2df53302 (commit) from 77574b214701e0f2750b949e7f65cbdd49a4ce31 (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 5e4f5981551ec79836ac25bda4fce0b707187fc0 Author: Daniel Baston Date: Tue Mar 24 12:01:36 2026 -0400 OverlayGraph: Use CoordinateXY for nodeMap diff --git a/include/geos/operation/overlayng/OverlayGraph.h b/include/geos/operation/overlayng/OverlayGraph.h index 39dcbd15b..eda4d07ed 100644 --- a/include/geos/operation/overlayng/OverlayGraph.h +++ b/include/geos/operation/overlayng/OverlayGraph.h @@ -51,12 +51,13 @@ namespace overlayng { // geos.operation.overlayng */ class GEOS_DLL OverlayGraph { using Coordinate = geos::geom::Coordinate; + using CoordinateXY = geos::geom::CoordinateXY; using CoordinateSequence = geos::geom::CoordinateSequence; private: // Members - std::unordered_map nodeMap; + std::unordered_map nodeMap; std::vector edges; // Locally store the OverlayEdge and OverlayLabel commit e5f11a9f5770ce2f537f0ab1962640077baf8d1a Author: Daniel Baston Date: Tue Mar 24 12:01:13 2026 -0400 OverlayEdge: Use CoordinateXY for direction point diff --git a/include/geos/operation/overlayng/OverlayEdge.h b/include/geos/operation/overlayng/OverlayEdge.h index 031e743a2..7ad5bdf9e 100644 --- a/include/geos/operation/overlayng/OverlayEdge.h +++ b/include/geos/operation/overlayng/OverlayEdge.h @@ -46,6 +46,7 @@ namespace overlayng { // geos.operation.overlayng */ class GEOS_DLL OverlayEdge : public edgegraph::HalfEdge { using Coordinate = geos::geom::Coordinate; + using CoordinateXY = geos::geom::CoordinateXY; using CoordinateXYZM = geos::geom::CoordinateXYZM; using CoordinateSequence = geos::geom::CoordinateSequence; using Location = geos::geom::Location; @@ -60,7 +61,7 @@ private: * The label must be interpreted accordingly. */ bool direction; - CoordinateXYZM dirPt; + CoordinateXY dirPt; OverlayLabel* label; bool m_isInResultArea; bool m_isInResultLine; @@ -78,7 +79,7 @@ private: public: - OverlayEdge(const CoordinateXYZM& p_orig, const CoordinateXYZM& p_dirPt, + OverlayEdge(const CoordinateXYZM& p_orig, const CoordinateXY& p_dirPt, bool p_direction, OverlayLabel* p_label, const std::shared_ptr& p_pts) : HalfEdge(p_orig) @@ -102,7 +103,7 @@ public: return direction; }; - const CoordinateXYZM& directionPt() const override + const CoordinateXY& directionPt() const override { return dirPt; }; commit a9efb9e0676d4626a995d36d9163d487dbe75579 Author: Daniel Baston Date: Tue Mar 24 11:56:50 2026 -0400 HalfEdge: Use CoordinateXY for directionPt diff --git a/include/geos/edgegraph/HalfEdge.h b/include/geos/edgegraph/HalfEdge.h index 20662f7be..ad44b92f0 100644 --- a/include/geos/edgegraph/HalfEdge.h +++ b/include/geos/edgegraph/HalfEdge.h @@ -109,7 +109,7 @@ protected: * * @return the direction point for the edge */ - virtual const geom::CoordinateXYZM& directionPt() const { return dest(); }; + virtual const geom::CoordinateXY& directionPt() const { return dest(); }; public: diff --git a/src/edgegraph/HalfEdge.cpp b/src/edgegraph/HalfEdge.cpp index 98f4b6759..54b5658e0 100644 --- a/src/edgegraph/HalfEdge.cpp +++ b/src/edgegraph/HalfEdge.cpp @@ -202,8 +202,8 @@ HalfEdge::compareAngularDirection(const HalfEdge* e) const * Check relative orientation of direction vectors * this is > e if it is CCW of e */ - const Coordinate& dir1 = directionPt(); - const Coordinate& dir2 = e->directionPt(); + const CoordinateXY& dir1 = directionPt(); + const CoordinateXY& dir2 = e->directionPt(); return algorithm::Orientation::index(e->m_orig, dir2, dir1); } commit 617ef6afe71fd4c7fccb6820b0b3b622a2885b09 Author: Daniel Baston Date: Tue Mar 24 11:53:41 2026 -0400 InputGeometry: avoid unnecessary 3D coord use diff --git a/include/geos/operation/overlayng/InputGeometry.h b/include/geos/operation/overlayng/InputGeometry.h index e1ff981e2..82532a093 100644 --- a/include/geos/operation/overlayng/InputGeometry.h +++ b/include/geos/operation/overlayng/InputGeometry.h @@ -42,6 +42,7 @@ class GEOS_DLL InputGeometry { using Geometry = geos::geom::Geometry; using Envelope = geos::geom::Envelope; using Coordinate = geos::geom::Coordinate; + using CoordinateXY = geos::geom::CoordinateXY; using Location = geos::geom::Location; using PointOnGeometryLocator = geos::algorithm::locate::PointOnGeometryLocator; @@ -91,7 +92,7 @@ public: * * @see Location */ - Location locatePointInArea(uint8_t geomIndex, const Coordinate& pt); + Location locatePointInArea(uint8_t geomIndex, const CoordinateXY& pt); PointOnGeometryLocator* getLocator(uint8_t geomIndex); void setCollapsed(uint8_t geomIndex, bool isGeomCollapsed); diff --git a/src/operation/overlayng/InputGeometry.cpp b/src/operation/overlayng/InputGeometry.cpp index dd350aa07..6c3c5a2ba 100644 --- a/src/operation/overlayng/InputGeometry.cpp +++ b/src/operation/overlayng/InputGeometry.cpp @@ -150,7 +150,7 @@ InputGeometry::hasEdges(uint8_t geomIndex) const */ /*public*/ Location -InputGeometry::locatePointInArea(uint8_t geomIndex, const Coordinate& pt) +InputGeometry::locatePointInArea(uint8_t geomIndex, const CoordinateXY& pt) { if (isCollapsed[geomIndex] || getGeometry(geomIndex)->isEmpty()) return Location::EXTERIOR; commit 6f19fd5cca6755766820b1422bc89dbafa08482f Author: Daniel Baston Date: Tue Mar 24 11:52:15 2026 -0400 TopologyException: construct from 2D point diff --git a/include/geos/util/TopologyException.h b/include/geos/util/TopologyException.h index 49b9a81f5..1109b0eb1 100644 --- a/include/geos/util/TopologyException.h +++ b/include/geos/util/TopologyException.h @@ -43,6 +43,12 @@ public: GEOSException("TopologyException", msg) {} + TopologyException(const std::string& msg, const geom::CoordinateXY& newPt) + : + GEOSException("TopologyException", msg + " at " + newPt.toString()), + pt(newPt) + {} + TopologyException(const std::string& msg, const geom::Coordinate& newPt) : GEOSException("TopologyException", msg + " at " + newPt.toString()), commit 1dbed71afb3a52f255e939774dfd2c6e2df53302 Author: Daniel Baston Date: Tue Mar 24 10:38:38 2026 -0400 Edge: Use CoordinateXY where possible diff --git a/include/geos/operation/overlayng/Edge.h b/include/geos/operation/overlayng/Edge.h index 4ed90968c..2af2a0c67 100644 --- a/include/geos/operation/overlayng/Edge.h +++ b/include/geos/operation/overlayng/Edge.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -220,7 +219,7 @@ public: return cs; }; - const geom::Coordinate& getCoordinate(std::size_t index) const + const geom::CoordinateXY& getCoordinate(std::size_t index) const { return pts->getAt(index); }; @@ -310,8 +309,8 @@ public: bool compareTo(const Edge& e) const { - const geom::Coordinate& ca = getCoordinate(0); - const geom::Coordinate& cb = e.getCoordinate(0); + const geom::CoordinateXY& ca = getCoordinate(0); + const geom::CoordinateXY& cb = e.getCoordinate(0); if(ca.compareTo(cb) < 0) { return true; } @@ -319,8 +318,8 @@ public: return false; } else { - const geom::Coordinate& cca = getCoordinate(1); - const geom::Coordinate& ccb = e.getCoordinate(1); + const geom::CoordinateXY& cca = getCoordinate(1); + const geom::CoordinateXY& ccb = e.getCoordinate(1); if(cca.compareTo(ccb) < 0) { return true; } diff --git a/include/geos/operation/overlayng/EdgeKey.h b/include/geos/operation/overlayng/EdgeKey.h index ef66e4653..a7f440564 100644 --- a/include/geos/operation/overlayng/EdgeKey.h +++ b/include/geos/operation/overlayng/EdgeKey.h @@ -61,7 +61,7 @@ private: } } - void init(const geom::Coordinate& p0, const geom::Coordinate& p1) + void init(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1) { p0x = p0.x; p0y = p0.y; ----------------------------------------------------------------------- Summary of changes: include/geos/edgegraph/HalfEdge.h | 2 +- include/geos/operation/overlayng/Edge.h | 11 +++++------ include/geos/operation/overlayng/EdgeKey.h | 2 +- include/geos/operation/overlayng/InputGeometry.h | 3 ++- include/geos/operation/overlayng/OverlayEdge.h | 7 ++++--- include/geos/operation/overlayng/OverlayGraph.h | 3 ++- include/geos/util/TopologyException.h | 6 ++++++ src/edgegraph/HalfEdge.cpp | 4 ++-- src/operation/overlayng/InputGeometry.cpp | 2 +- 9 files changed, 24 insertions(+), 16 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 10:42:42 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 10:42:42 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 861ed20b38bb26067f5a552302b30d3637c03bdf Message-ID: <20260324174243.2D53C3538B@trac.osgeo.org> 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 861ed20b38bb26067f5a552302b30d3637c03bdf (commit) from 5e4f5981551ec79836ac25bda4fce0b707187fc0 (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 861ed20b38bb26067f5a552302b30d3637c03bdf Author: Daniel Baston Date: Tue Mar 24 13:42:22 2026 -0400 LineLimiter: Avoid dropping M values (#1408) diff --git a/include/geos/operation/overlayng/EdgeNodingBuilder.h b/include/geos/operation/overlayng/EdgeNodingBuilder.h index cae8a44e7..0927241ba 100644 --- a/include/geos/operation/overlayng/EdgeNodingBuilder.h +++ b/include/geos/operation/overlayng/EdgeNodingBuilder.h @@ -140,7 +140,7 @@ private: * limit the line to the clip envelope. * */ - std::vector>& limit(const LineString* line); + std::vector>& limit(const LineString* line) const; /** * If a clipper is present, diff --git a/include/geos/operation/overlayng/LineLimiter.h b/include/geos/operation/overlayng/LineLimiter.h index 8a9b27f49..91f00eeec 100644 --- a/include/geos/operation/overlayng/LineLimiter.h +++ b/include/geos/operation/overlayng/LineLimiter.h @@ -54,6 +54,7 @@ namespace overlayng { // geos.operation.overlayng class GEOS_DLL LineLimiter { using Envelope = geos::geom::Envelope; using Coordinate = geos::geom::Coordinate; + using CoordinateXY = geos::geom::CoordinateXY; using CoordinateSequence = geos::geom::CoordinateSequence; private: @@ -61,14 +62,21 @@ private: // Members const Envelope* limitEnv; std::unique_ptr ptList; - const Coordinate* lastOutside; + const CoordinateXY* lastOutside; std::vector> sections; + bool hasZ{false}; + bool hasM{false}; // Methods - void addPoint(const Coordinate* p); - void addOutside(const Coordinate* p); - bool isLastSegmentIntersecting(const Coordinate* p); - bool isSectionOpen(); + template + void addPoint(const CoordType& p); + + template + void addOutside(const CoordType& p); + bool isLastSegmentIntersecting(const CoordinateXY& p) const; + bool isSectionOpen() const; + + template void startSection(); void finishSection(); diff --git a/src/operation/overlayng/EdgeNodingBuilder.cpp b/src/operation/overlayng/EdgeNodingBuilder.cpp index d63f4acb3..b063770f1 100644 --- a/src/operation/overlayng/EdgeNodingBuilder.cpp +++ b/src/operation/overlayng/EdgeNodingBuilder.cpp @@ -414,7 +414,7 @@ EdgeNodingBuilder::isToBeLimited(const LineString* line) const /*private*/ std::vector>& -EdgeNodingBuilder::limit(const LineString* line) +EdgeNodingBuilder::limit(const LineString* line) const { const CoordinateSequence* pts = line->getCoordinatesRO(); return limiter->limit(pts); diff --git a/src/operation/overlayng/LineLimiter.cpp b/src/operation/overlayng/LineLimiter.cpp index 57036e248..f1410f424 100644 --- a/src/operation/overlayng/LineLimiter.cpp +++ b/src/operation/overlayng/LineLimiter.cpp @@ -34,32 +34,36 @@ LineLimiter::limit(const CoordinateSequence *pts) lastOutside = nullptr; ptList.reset(nullptr); sections.clear(); + hasZ = pts->hasZ(); + hasM = pts->hasM(); - for (std::size_t i = 0; i < pts->size(); i++) { - const Coordinate* p = &(pts->getAt(i)); - if (limitEnv->intersects(*p)) { + pts->forEach([this](const auto& p) { + if (limitEnv->intersects(p)) { addPoint(p); } else { addOutside(p); } - } + }); + // finish last section, if any finishSection(); return sections; } /*private*/ +template void -LineLimiter::addPoint(const Coordinate* p) +LineLimiter::addPoint(const CoordType& p) { - startSection(); - ptList->add(*p, false); + startSection(); + ptList->add(p, false); } /*private*/ +template void -LineLimiter::addOutside(const Coordinate* p) +LineLimiter::addOutside(const CoordType& p) { bool segIntersects = isLastSegmentIntersecting(p); if (!segIntersects) { @@ -67,16 +71,16 @@ LineLimiter::addOutside(const Coordinate* p) } else { if(lastOutside != nullptr) { - addPoint(lastOutside); + addPoint(*static_cast(lastOutside)); } addPoint(p); } - lastOutside = p; + lastOutside = &p; } /*private*/ bool -LineLimiter::isLastSegmentIntersecting(const Coordinate* p) +LineLimiter::isLastSegmentIntersecting(const CoordinateXY& p) const { if (lastOutside == nullptr) { // last point must have been inside @@ -84,26 +88,27 @@ LineLimiter::isLastSegmentIntersecting(const Coordinate* p) return true; return false; } - return limitEnv->intersects(*lastOutside, *p); + return limitEnv->intersects(*lastOutside, p); } /*private*/ bool -LineLimiter::isSectionOpen() +LineLimiter::isSectionOpen() const { return ptList != nullptr; } /*private*/ +template void LineLimiter::startSection() { if (!isSectionOpen()) { - ptList = detail::make_unique(); + ptList = std::make_unique(0, hasZ, hasM); } if (lastOutside != nullptr) { - ptList->add(*lastOutside, false); + ptList->add(*static_cast(lastOutside), false); } lastOutside = nullptr; } @@ -125,7 +130,7 @@ LineLimiter::finishSection() assert(!ptList->hasRepeatedPoints()); //ptList->erase(std::unique(ptList->begin(), ptList->end()), ptList->end()); - sections.emplace_back(ptList.release()); + sections.push_back(std::move(ptList)); ptList.reset(nullptr); } diff --git a/tests/unit/operation/overlayng/LineLimiterTest.cpp b/tests/unit/operation/overlayng/LineLimiterTest.cpp index 025200b97..af9ef9334 100644 --- a/tests/unit/operation/overlayng/LineLimiterTest.cpp +++ b/tests/unit/operation/overlayng/LineLimiterTest.cpp @@ -49,7 +49,7 @@ struct test_linelimiter_data { // std::cout << "--expect--" << std::endl; // std::cout << w.write(expected.get()) << std::endl; - ensure_equals_geometry(expected.get(), result.get()); + ensure_equals_geometry_xyzm(expected.get(), result.get()); } std::unique_ptr @@ -170,7 +170,17 @@ void object::test<8> () checkLimit(wkt, env, expected); } +template<> +template<> +void object::test<9>() +{ + set_test_name("M values preserved"); + std::string wkt= "LINESTRING M (7 17 1, 23 17 2, 23 13 3, 7 13 4)"; + Envelope env(10,20,10,20); + std::string expected = "MULTILINESTRING M ((7 17 1, 23 17 2), (23 13 3, 7 13 4))"; + checkLimit(wkt, env, expected); +} } // namespace tut diff --git a/tests/unit/operation/overlayng/OverlayNGZTest.cpp b/tests/unit/operation/overlayng/OverlayNGZTest.cpp index 732d7eb25..d8625d3cb 100644 --- a/tests/unit/operation/overlayng/OverlayNGZTest.cpp +++ b/tests/unit/operation/overlayng/OverlayNGZTest.cpp @@ -326,4 +326,16 @@ void object::test<22> () "POLYGON M ((2 6 7, 3 9 3.875, 9 9 2, 9 5 5.5, 7 6 8, 2 6 7))"); } +template<> +template<> +void object::test<23> () +{ + set_test_name("LINESTRING XYM / LINESTRING XYM intersection"); + + // inputs need > 20 vertices to activate LineLimiter + checkIntersection("LINESTRING M (4 12 6,3.5 10.5 6.2,3 9 6.5,2.5 7.5 6.8,2 6 7,3.7 6 7.3,5.3 6 7.7,7 6 8,8.3 5.3 8.3,9.7 4.7 8.7,11 4 9,11.7 5.8 9.2,12.3 7.7 9.3,13 9.5 9.5,13.7 11.3 9.7,14.3 13.2 9.8,15 15 10,13.2 14.5 9.3,11.3 14 8.7,9.5 13.5 8,7.7 13 7.3,5.8 12.5 6.7,4 12 6)", + "LINESTRING M (1 9 1,2.3 9 1.2,3.7 9 1.3,5 9 1.5,6.3 9 1.7,7.7 9 1.8,9 9 2,9 7.7 2.2,9 6.3 2.3,9 5 2.5,9 3.7 2.7,9 2.3 2.8,9 1 3,7.7 1 3.2,6.3 1 3.3,5 1 3.5,3.7 1 3.7,2.3 1 3.8,1 1 4,1 2.3 3.5,1 3.7 3,1 5 2.5,1 6.3 2,1 7.7 1.5,1 9 1)", + "MULTIPOINT M ((3 9 6.5), (9 5 2.5))"); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: .../geos/operation/overlayng/EdgeNodingBuilder.h | 2 +- include/geos/operation/overlayng/LineLimiter.h | 18 ++++++++--- src/operation/overlayng/EdgeNodingBuilder.cpp | 2 +- src/operation/overlayng/LineLimiter.cpp | 37 ++++++++++++---------- tests/unit/operation/overlayng/LineLimiterTest.cpp | 12 ++++++- tests/unit/operation/overlayng/OverlayNGZTest.cpp | 12 +++++++ 6 files changed, 59 insertions(+), 24 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 10:46:34 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 10:46:34 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. afe57da9baff42e27afdbec613bb0fa8394eaba5 Message-ID: <20260324174635.1CEBF31C56@trac.osgeo.org> 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 afe57da9baff42e27afdbec613bb0fa8394eaba5 (commit) from 861ed20b38bb26067f5a552302b30d3637c03bdf (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 afe57da9baff42e27afdbec613bb0fa8394eaba5 Author: Daniel Baston Date: Tue Mar 24 13:46:14 2026 -0400 GeometryPrecisionReducer: Support curved types for pointwise precision reduction (#1402) diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 635bfff64..4637c5ab4 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -5622,6 +5622,7 @@ extern GEOSGeometry GEOS_DLL *GEOSSnap( * has the same semantics as GEOS_PREC_NO_TOPO * * Z and M values in the input are preserved. +* Curved geometries are supported since GEOS 3.15 if GEOS_PREC_NO_TOPO is used. * * \param g Input geometry * \param gridSize cell size of grid to round coordinates to, diff --git a/include/geos/geom/Quadrant.h b/include/geos/geom/Quadrant.h index d7a9e9519..0c616dc47 100644 --- a/include/geos/geom/Quadrant.h +++ b/include/geos/geom/Quadrant.h @@ -70,7 +70,7 @@ public: std::ostringstream s; s << "Cannot compute the quadrant for point "; s << "(" << dx << "," << dy << ")" << std::endl; - throw util::IllegalArgumentException(s.str()); + throw geos::util::IllegalArgumentException(s.str()); } if(dx >= 0) { if(dy >= 0) { @@ -98,7 +98,7 @@ public: static int quadrant(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1) { if(p1.x == p0.x && p1.y == p0.y) { - throw util::IllegalArgumentException("Cannot compute the quadrant for two identical points " + p0.toString()); + throw geos::util::IllegalArgumentException("Cannot compute the quadrant for two identical points " + p0.toString()); } if(p1.x >= p0.x) { diff --git a/include/geos/geom/util/GeometryTransformer.h b/include/geos/geom/util/GeometryTransformer.h index 7cbe0c35f..a2f9bcaca 100644 --- a/include/geos/geom/util/GeometryTransformer.h +++ b/include/geos/geom/util/GeometryTransformer.h @@ -41,6 +41,11 @@ class MultiPoint; class MultiPolygon; class MultiLineString; class GeometryCollection; +class CircularString; +class CompoundCurve; +class CurvePolygon; +class MultiCurve; +class MultiSurface; namespace util { //class GeometryEditorOperation; } @@ -121,6 +126,14 @@ protected: const LineString* geom, const Geometry* parent); + virtual Geometry::Ptr transformCircularString( + const CircularString* geom, + const Geometry* parent); + + virtual Geometry::Ptr transformCompoundCurve( + const CompoundCurve* geom, + const Geometry* parent); + virtual Geometry::Ptr transformMultiLineString( const MultiLineString* geom, const Geometry* parent); @@ -129,10 +142,22 @@ protected: const Polygon* geom, const Geometry* parent); + virtual Geometry::Ptr transformCurvePolygon( + const CurvePolygon* geom, + const Geometry* parent); + virtual Geometry::Ptr transformMultiPolygon( const MultiPolygon* geom, const Geometry* parent); + virtual Geometry::Ptr transformMultiCurve( + const MultiCurve* geom, + const Geometry* parent); + + virtual Geometry::Ptr transformMultiSurface( + const MultiSurface* geom, + const Geometry* parent); + virtual Geometry::Ptr transformGeometryCollection( const GeometryCollection* geom, const Geometry* parent); diff --git a/include/geos/operation/overlay/snap/GeometrySnapper.h b/include/geos/operation/overlay/snap/GeometrySnapper.h index 63f092f02..757d72dfa 100644 --- a/include/geos/operation/overlay/snap/GeometrySnapper.h +++ b/include/geos/operation/overlay/snap/GeometrySnapper.h @@ -24,6 +24,8 @@ #include #include +#include "geos/util.h" + // Forward declarations namespace geos { namespace geom { @@ -80,11 +82,7 @@ public: * * @param g the geometry to snap */ - GeometrySnapper(const geom::Geometry& g) - : - srcGeom(g) - { - } + GeometrySnapper(const geom::Geometry& g); /** \brief * Snaps the vertices in the component {@link geom::LineString}s @@ -138,7 +136,7 @@ private: const geom::Geometry& srcGeom; /// Extract target (unique) coordinates - std::unique_ptr extractTargetCoordinates( + static std::unique_ptr extractTargetCoordinates( const geom::Geometry& g); // Declare type as noncopyable diff --git a/src/geom/util/Densifier.cpp b/src/geom/util/Densifier.cpp index a344757b4..19ec91d3a 100644 --- a/src/geom/util/Densifier.cpp +++ b/src/geom/util/Densifier.cpp @@ -103,7 +103,9 @@ Densifier::DensifyTransformer::createValidArea(const Geometry* roughAreaGeom) Densifier::Densifier(const Geometry* geom): inputGeom(geom) -{} +{ + geos::util::ensureNoCurvedComponents(geom); +} std::unique_ptr Densifier::densifyPoints(const CoordinateSequence& pts, double distanceTolerance, const PrecisionModel* precModel) diff --git a/src/geom/util/GeometryTransformer.cpp b/src/geom/util/GeometryTransformer.cpp index afa01ce32..815d85ce0 100644 --- a/src/geom/util/GeometryTransformer.cpp +++ b/src/geom/util/GeometryTransformer.cpp @@ -18,11 +18,16 @@ **********************************************************************/ #include +#include +#include +#include #include #include +#include #include #include #include +#include #include #include #include @@ -84,29 +89,33 @@ GeometryTransformer::transform(const Geometry* nInputGeom) return inputGeom->clone(); } - if(const Point* p = dynamic_cast(inputGeom)) { - return transformPoint(p, nullptr); - } - if(const MultiPoint* mp = dynamic_cast(inputGeom)) { - return transformMultiPoint(mp, nullptr); - } - if(const LinearRing* lr = dynamic_cast(inputGeom)) { - return transformLinearRing(lr, nullptr); - } - if(const LineString* ls = dynamic_cast(inputGeom)) { - return transformLineString(ls, nullptr); - } - if(const MultiLineString* mls = dynamic_cast(inputGeom)) { - return transformMultiLineString(mls, nullptr); - } - if(const Polygon* p = dynamic_cast(inputGeom)) { - return transformPolygon(p, nullptr); - } - if(const MultiPolygon* mp = dynamic_cast(inputGeom)) { - return transformMultiPolygon(mp, nullptr); - } - if(const GeometryCollection* gc = dynamic_cast(inputGeom)) { - return transformGeometryCollection(gc, nullptr); + switch (inputGeom->getGeometryTypeId()) { + case GEOS_POINT: + return transformPoint(detail::down_cast(inputGeom), nullptr); + case GEOS_LINESTRING: + return transformLineString(detail::down_cast(inputGeom), nullptr); + case GEOS_LINEARRING: + return transformLinearRing(detail::down_cast(inputGeom), nullptr); + case GEOS_POLYGON: + return transformPolygon(detail::down_cast(inputGeom), nullptr); + case GEOS_CIRCULARSTRING: + return transformCircularString(detail::down_cast(inputGeom), nullptr); + case GEOS_COMPOUNDCURVE: + return transformCompoundCurve(detail::down_cast(inputGeom), nullptr); + case GEOS_CURVEPOLYGON: + return transformCurvePolygon(detail::down_cast(inputGeom), nullptr); + case GEOS_MULTIPOINT: + return transformMultiPoint(detail::down_cast(inputGeom), nullptr); + case GEOS_MULTILINESTRING: + return transformMultiLineString(detail::down_cast(inputGeom), nullptr); + case GEOS_MULTIPOLYGON: + return transformMultiPolygon(detail::down_cast(inputGeom), nullptr); + case GEOS_MULTICURVE: + return transformMultiCurve(detail::down_cast(inputGeom), nullptr); + case GEOS_MULTISURFACE: + return transformMultiSurface(detail::down_cast(inputGeom), nullptr); + case GEOS_GEOMETRYCOLLECTION: + return transformGeometryCollection(detail::down_cast(inputGeom), nullptr); } throw IllegalArgumentException("Unknown Geometry subtype."); @@ -224,6 +233,78 @@ GeometryTransformer::transformLineString( transformCoordinates(geom->getCoordinatesRO(), geom)); } +std::unique_ptr +GeometryTransformer::transformCircularString( + const CircularString* geom, + const Geometry* parent) +{ + ::geos::ignore_unused_variable_warning(parent); + +#if GEOS_DEBUG + std::cerr << "GeometryTransformer::transformCircularString(CircularString " << geom << ", Geometry " << parent << ");" + << std::endl; +#endif + + return factory->createCircularString( + transformCoordinates(geom->getCoordinatesRO(), geom)); +} + +std::unique_ptr +GeometryTransformer::transformCompoundCurve( + const CompoundCurve* geom, + const Geometry* parent) +{ + ::geos::ignore_unused_variable_warning(parent); + +#if GEOS_DEBUG + std::cerr << "GeometryTransformer::transformCompoundCurve(CompoundCurve " << geom << ", Geometry " << parent << ");" + << std::endl; +#endif + + std::vector> curves; + std::vector> components; + bool outputIsCompoundCurve = true; + + for(std::size_t i = 0; i < geom->getNumCurves(); i++) { + const SimpleCurve* c = geom->getCurveN(i); + + std::unique_ptr transformGeom; + if(const CircularString* cs = dynamic_cast(c)) { + transformGeom = transformCircularString(cs, geom); + } + else if(const LineString* ls = dynamic_cast(c)) { + transformGeom = transformLineString(ls, geom); + } + else { + throw geos::util::IllegalArgumentException("Unknown Curve subtype."); + } + + if(transformGeom == nullptr || transformGeom->isEmpty()) { + continue; + } + + if (!dynamic_cast(transformGeom.get())) { + outputIsCompoundCurve = false; + + for (auto& curve : curves) { + components.push_back(std::move(curve)); + } + } + + if (outputIsCompoundCurve) { + curves.emplace_back(detail::down_cast(transformGeom.release())); + } else { + components.push_back(std::move(transformGeom)); + } + } + + if (outputIsCompoundCurve) { + return factory->createCompoundCurve(std::move(curves)); + } + + return factory->buildGeometry(std::move(components)); +} + Geometry::Ptr GeometryTransformer::transformMultiLineString( const MultiLineString* geom, @@ -261,6 +342,34 @@ GeometryTransformer::transformMultiLineString( } +std::unique_ptr +GeometryTransformer::transformMultiCurve( + const MultiCurve* geom, + const Geometry* parent) +{ + ::geos::ignore_unused_variable_warning(parent); + +#if GEOS_DEBUG + std::cerr << "GeometryTransformer::transformMultiCurve(MultiCurve " << geom << ", Geometry " << parent << ");" + << std::endl; +#endif + + std::vector> components; + for(std::size_t i = 0; i < geom->getNumGeometries(); i++) { + auto transformGeom = transform(geom->getGeometryN(i)); + + if(transformGeom && !transformGeom->isEmpty()) { + components.push_back(std::move(transformGeom)); + } + } + + if (components.empty()) { + return factory->createMultiCurve(); + } + + return factory->buildGeometry(std::move(components)); +} + Geometry::Ptr GeometryTransformer::transformPolygon( const Polygon* geom, @@ -325,6 +434,93 @@ GeometryTransformer::transformPolygon( } +std::unique_ptr +GeometryTransformer::transformCurvePolygon( + const CurvePolygon* geom, + const Geometry* parent) +{ + ::geos::ignore_unused_variable_warning(parent); + +#if GEOS_DEBUG + std::cerr << "GeometryTransformer::transformCurvePolygon(CurvePolygon " << geom << ", Geometry " << parent << ");" + << std::endl; +#endif + + bool isAllValidCurves = true; + + const Curve* shellIn = geom->getExteriorRing(); + assert(shellIn); + + std::unique_ptr shell; + if(const CompoundCurve* cc = dynamic_cast(shellIn)) { + shell = transformCompoundCurve(cc, geom); + } + else if(const CircularString* cs = dynamic_cast(shellIn)) { + shell = transformCircularString(cs, geom); + } + else if(const LineString* ls = dynamic_cast(shellIn)) { + shell = transformLineString(ls, geom); + } + else { + throw geos::util::IllegalArgumentException("Unknown Curve subtype."); + } + + if(shell == nullptr || !dynamic_cast(shell.get()) || shell->isEmpty()) { + isAllValidCurves = false; + } + + std::vector> holes; + for(std::size_t i = 0, n = geom->getNumInteriorRing(); i < n; i++) { + const Curve* holeIn = geom->getInteriorRingN(i); + assert(holeIn); + + Geometry::Ptr hole; + if(const CompoundCurve* cc = dynamic_cast(holeIn)) { + hole = transformCompoundCurve(cc, geom); + } + else if(const CircularString* cs = dynamic_cast(holeIn)) { + hole = transformCircularString(cs, geom); + } + else if(const LineString* ls = dynamic_cast(holeIn)) { + hole = transformLineString(ls, geom); + } + else { + throw geos::util::IllegalArgumentException("Unknown Curve subtype."); + } + + if(hole == nullptr || hole->isEmpty()) { + continue; + } + + if(dynamic_cast(hole.get())) { + holes.emplace_back(dynamic_cast(hole.release())); + } + else { + if(skipTransformedInvalidInteriorRings) { + continue; + } + isAllValidCurves = false; + } + } + + if(isAllValidCurves) { + std::unique_ptr shellCurve(dynamic_cast(shell.release())); + return factory->createCurvePolygon(std::move(shellCurve), std::move(holes)); + } + else { + std::vector> components; + if(shell != nullptr) { + components.push_back(std::move(shell)); + } + + for(auto& g : holes) { + components.push_back(std::move(g)); + } + + return factory->buildGeometry(std::move(components)); + } +} + Geometry::Ptr GeometryTransformer::transformMultiPolygon( const MultiPolygon* geom, @@ -350,7 +546,6 @@ GeometryTransformer::transformMultiPolygon( if(transformGeom->isEmpty()) { continue; } - transGeomList.push_back(std::move(transformGeom)); } @@ -362,6 +557,34 @@ GeometryTransformer::transformMultiPolygon( } +std::unique_ptr +GeometryTransformer::transformMultiSurface( + const MultiSurface* geom, + const Geometry* parent) +{ + ::geos::ignore_unused_variable_warning(parent); + +#if GEOS_DEBUG + std::cerr << "GeometryTransformer::transformMultiSurface(MultiSurface " << geom << ", Geometry " << parent << ");" + << std::endl; +#endif + + std::vector> components; + for(std::size_t i = 0; i < geom->getNumGeometries(); i++) { + auto transformGeom = transform(geom->getGeometryN(i)); + + if(transformGeom && !transformGeom->isEmpty()) { + components.push_back(std::move(transformGeom)); + } + } + + if (components.empty()) { + return factory->createMultiSurface(); + } + + return factory->buildGeometry(std::move(components)); +} + Geometry::Ptr GeometryTransformer::transformGeometryCollection( const GeometryCollection* geom, diff --git a/src/operation/overlay/snap/GeometrySnapper.cpp b/src/operation/overlay/snap/GeometrySnapper.cpp index 7a13005f5..c0b429739 100644 --- a/src/operation/overlay/snap/GeometrySnapper.cpp +++ b/src/operation/overlay/snap/GeometrySnapper.cpp @@ -87,6 +87,12 @@ public: }; +GeometrySnapper::GeometrySnapper(const Geometry& g) + : srcGeom(g) +{ + util::ensureNoCurvedComponents(g); +} + /*private*/ std::unique_ptr GeometrySnapper::extractTargetCoordinates(const Geometry& g) diff --git a/src/simplify/TopologyPreservingSimplifier.cpp b/src/simplify/TopologyPreservingSimplifier.cpp index 85e39e1d5..b796610e0 100644 --- a/src/simplify/TopologyPreservingSimplifier.cpp +++ b/src/simplify/TopologyPreservingSimplifier.cpp @@ -35,6 +35,8 @@ #include #include +#include "geos/util.h" + #ifndef GEOS_DEBUG #define GEOS_DEBUG 0 #endif @@ -214,6 +216,7 @@ TopologyPreservingSimplifier::TopologyPreservingSimplifier(const Geometry* geom) inputGeom(geom), lineSimplifier(new TaggedLinesSimplifier()) { + util::ensureNoCurvedComponents(geom); } /*public*/ diff --git a/tests/unit/precision/GeometryPrecisionReducerTest.cpp b/tests/unit/precision/GeometryPrecisionReducerTest.cpp index 2550a34bf..cd007c7b6 100644 --- a/tests/unit/precision/GeometryPrecisionReducerTest.cpp +++ b/tests/unit/precision/GeometryPrecisionReducerTest.cpp @@ -52,12 +52,12 @@ struct test_gpr_data { void checkReducePointwise( const std::string& wkt, - const std::string& wktExpected) + const std::string& wktExpected) const { std::unique_ptr g = reader_.read(wkt); std::unique_ptr expected = reader_.read(wktExpected); std::unique_ptr actual = GeometryPrecisionReducer::reducePointwise(*g, pm_fixed_); - ensure_equals_geometry(expected.get(), actual.get()); + ensure_equals_exact_geometry_xyzm(expected.get(), actual.get(), 0); ensure("Factories are not the same", expected->getFactory() == actual->getFactory()); } @@ -409,7 +409,65 @@ void object::test<28> () "MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((10 10, 11 10, 11 11, 10 11, 10 10)))"); } +template<> +template<> +void object::test<29>() +{ + set_test_name("CircularString pointwise"); + checkReducePointwise("CIRCULARSTRING (1.23 2.34, 4.56 5.67, 8.910 3.21)", + "CIRCULARSTRING (1 2, 5 6, 9 3)"); +} + +template<> +template<> +void object::test<30>() +{ + set_test_name("CompoundCurve pointwise"); + + checkReducePointwise("COMPOUNDCURVE ((0 0, 1.23 2.34), CIRCULARSTRING (1.23 2.34, 4.56 5.67, 8.910 3.21), (8.91 3.21, 10 10))", + "COMPOUNDCURVE ((0 0, 1 2), CIRCULARSTRING(1 2, 5 6, 9 3), (9 3, 10 10))"); +} + +template<> +template<> +void object::test<31>() +{ + set_test_name("CurvePolygon pointwise"); + + // CompoundCurve shell, no holes + checkReducePointwise("CURVEPOLYGON (COMPOUNDCURVE ((8.91 3.21, 1.23 2.34), CIRCULARSTRING (1.23 2.34, 4.56 5.67, 8.910 3.21)))", + "CURVEPOLYGON (COMPOUNDCURVE ((9 3, 1 2), CIRCULARSTRING (1 2, 5 6, 9 3)))"); + + // LineString shell, CircularString hole + checkReducePointwise("CURVEPOLYGON ((0 0, 10 0, 10.1 10, 0 10, 0 0), CIRCULARSTRING (5 5, 6 6, 7 5.4, 6 4, 5 5))", + "CURVEPOLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), CIRCULARSTRING (5 5, 6 6, 7 5, 6 4, 5 5))"); + + // CircularString shell, LineString hole, CompoundCurve hole + checkReducePointwise( + "CURVEPOLYGON (CIRCULARSTRING (-5 0, 0 5.2, 5 0, 0 -5, -5 0), (0 0, 1 0, 1 1.3, 0 1, 0 0), COMPOUNDCURVE((-2 -2, 0 -2), CIRCULARSTRING (0 -2, -1 -0.8, -2 -2)))", + "CURVEPOLYGON (CIRCULARSTRING (-5 0, 0 5, 5 0, 0 -5, -5 0), (0 0, 1 0, 1 1, 0 1, 0 0), COMPOUNDCURVE((-2 -2, 0 -2), CIRCULARSTRING (0 -2, -1 -1, -2 -2)))"); +} + +template<> +template<> +void object::test<32>() +{ + set_test_name("MultiCurve pointwise"); + + checkReducePointwise("MULTICURVE ((100.1 100, 102 102), COMPOUNDCURVE ((0 0, 1.23 2.34), CIRCULARSTRING (1.23 2.34, 4.56 5.67, 8.910 3.21), (8.91 3.21, 10 10)))", + "MULTICURVE ((100 100, 102 102), COMPOUNDCURVE ((0 0, 1 2), CIRCULARSTRING(1 2, 5 6, 9 3), (9 3, 10 10)))"); +} + +template<> +template<> +void object::test<33>() +{ + set_test_name("MultiSurface pointwise"); + + checkReducePointwise("MULTISURFACE(CURVEPOLYGON (COMPOUNDCURVE ((8.91 3.21, 1.23 2.34), CIRCULARSTRING (1.23 2.34, 4.56 5.67, 8.910 3.21))), ((5 0, 10.2 0, 10 2, 5 0)))", + "MULTISURFACE(CURVEPOLYGON (COMPOUNDCURVE ((9 3, 1 2), CIRCULARSTRING (1 2, 5 6, 9 3))), ((5 0, 10 0, 10 2, 5 0)))"); +} template<> template<> ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 1 + include/geos/geom/Quadrant.h | 4 +- include/geos/geom/util/GeometryTransformer.h | 25 ++ .../geos/operation/overlay/snap/GeometrySnapper.h | 10 +- src/geom/util/Densifier.cpp | 4 +- src/geom/util/GeometryTransformer.cpp | 271 +++++++++++++++++++-- src/operation/overlay/snap/GeometrySnapper.cpp | 6 + src/simplify/TopologyPreservingSimplifier.cpp | 3 + .../precision/GeometryPrecisionReducerTest.cpp | 62 ++++- 9 files changed, 351 insertions(+), 35 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 13:46:22 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 13:46:22 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. b4ffacf814c0095b7631ed2e0b2757aaf3d6b33b Message-ID: <20260324204623.3A94136B84@trac.osgeo.org> 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 b4ffacf814c0095b7631ed2e0b2757aaf3d6b33b (commit) from afe57da9baff42e27afdbec613bb0fa8394eaba5 (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 b4ffacf814c0095b7631ed2e0b2757aaf3d6b33b Author: Mike Taves Date: Wed Mar 25 09:45:58 2026 +1300 CI: build container tags using docker/metadata-action (#1400) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 07a0abb8c..0c755d659 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -9,6 +9,8 @@ on: push: branches: - main + tags: + - '*.*.*' paths-ignore: - 'web/**' @@ -24,8 +26,17 @@ jobs: - uses: actions/checkout at v6 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action at v4 + - name: Docker meta + id: meta + uses: docker/metadata-action at v6 + with: + images: ghcr.io/libgeos/geosop + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}} + type=sha - name: Login to GitHub Container Registry uses: docker/login-action at v4 @@ -34,6 +45,9 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action at v4 + - name: Get Dockerfile run: | cp tools/ci/geosop/Dockerfile . @@ -42,11 +56,6 @@ jobs: uses: docker/build-push-action at v7 with: context: . - # platforms: linux/amd64,linux/arm64 - platforms: linux/amd64 push: true - tags: | - ghcr.io/libgeos/geosop:latest - - - + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/tools/ci/geosop/Dockerfile b/tools/ci/geosop/Dockerfile index 5854cd3bc..a20b783bf 100644 --- a/tools/ci/geosop/Dockerfile +++ b/tools/ci/geosop/Dockerfile @@ -1,28 +1,38 @@ -FROM docker.osgeo.org/geos/build-test:alpine AS base -ARG VERSION=47f145e +ARG BASEIMAGE="alpine:3.23" +ARG GEOS_VERSION + +FROM ${BASEIMAGE} AS builder + +RUN apk add --no-cache \ + cmake \ + ninja \ + g++ \ + gcc -WORKDIR /source ADD . /source -#RUN wget --quiet https://github.com/libgeos/geos/archive/${VERSION}.tar.gz --output-document - \ -#| tar xz --directory=. --strip-components=1 +ARG GEOS_VERSION +ENV GEOS_VERSION=${GEOS_VERSION} +RUN if [ -n "${GEOS_VERSION}" ]; then \ + rm -rf /source && mkdir /source && \ + wget https://github.com/libgeos/geos/archive/${GEOS_VERSION}.tar.gz \ + --output-document - | tar xz --directory=/source --strip-components=1; \ + fi -WORKDIR /build -RUN cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_BENCHMARKS=OFF -D BUILD_TESTING=OFF /source \ - && make install \ - && cp bin/geosop /usr/local/bin/geosop +RUN cmake -S /source -B /build -G Ninja \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_INSTALL_LIBDIR=lib \ + -D BUILD_BENCHMARKS=OFF \ + -D BUILD_DOCUMENTATION=OFF \ + -D BUILD_TESTING=OFF \ + && cmake --build /build \ + && cmake --install /build --prefix /install --strip -WORKDIR /install/bin -RUN cp --no-dereference /usr/local/bin/geos* . \ - && for i in ./*; do strip -s $i 2>/dev/null || /bin/true; done +FROM ${BASEIMAGE} AS runner -WORKDIR /install/lib -RUN cp --no-dereference /usr/local/lib*/libgeos*.so.* . \ - && for i in ./*; do strip -s $i 2>/dev/null || /bin/true; done - -FROM alpine RUN apk add --no-cache libstdc++ -COPY --from=base /install/bin/geos* /usr/local/bin/ -COPY --from=base /install/lib/libgeos* /usr/local/lib/ + +COPY --from=builder /install/bin/geosop /usr/local/bin/geosop +COPY --from=builder /install/lib/libgeos.* /usr/local/lib/ ENTRYPOINT ["geosop"] ----------------------------------------------------------------------- Summary of changes: .github/workflows/container.yml | 27 +++++++++++++++-------- tools/ci/geosop/Dockerfile | 48 +++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 28 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 14:05:00 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 14:05:00 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. c7d3c151f0e39faac66091a3ad4510eea6754eba Message-ID: <20260324210502.9F4F336C8F@trac.osgeo.org> 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 c7d3c151f0e39faac66091a3ad4510eea6754eba (commit) from b4ffacf814c0095b7631ed2e0b2757aaf3d6b33b (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 c7d3c151f0e39faac66091a3ad4510eea6754eba Author: Daniel Baston Date: Tue Mar 24 16:40:06 2026 -0400 geos_unit: add missing check in GeometryCollection equality test diff --git a/tests/unit/utility.h b/tests/unit/utility.h index 21825988b..a9003be56 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -407,7 +407,11 @@ ensure_equals_exact_geometry_xyz(const geos::geom::Geometry *lhs_in, } else if (const GeometryCollection* gc1 = dynamic_cast(lhs_in)) { const GeometryCollection *gc2 = static_cast(rhs_in); - for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { + ensure_equals("number of components does not match", + gc1->getNumGeometries(), + gc2->getNumGeometries()); + + for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { ensure_equals_exact_geometry_xyz(gc1->getGeometryN(i), gc2->getGeometryN(i), tolerance); } } @@ -493,7 +497,11 @@ ensure_equals_exact_geometry_xyzm(const geos::geom::Geometry *lhs_in, } else if (const GeometryCollection* gc1 = dynamic_cast(lhs_in)) { const GeometryCollection *gc2 = static_cast(rhs_in); - for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { + ensure_equals("number of components does not match", + gc1->getNumGeometries(), + gc2->getNumGeometries()); + + for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { ensure_equals_exact_geometry_xyzm(gc1->getGeometryN(i), gc2->getGeometryN(i), tolerance); } } else { @@ -584,6 +592,10 @@ ensure_equals_exact_geometry(const geos::geom::Geometry *lhs_in, } else if (const GeometryCollection* gc1 = dynamic_cast(lhs_in)) { const GeometryCollection *gc2 = static_cast(rhs_in); + ensure_equals("number of components does not match", + gc1->getNumGeometries(), + gc2->getNumGeometries()); + for (unsigned int i = 0; i < gc1->getNumGeometries(); i++) { ensure_equals_exact_geometry(gc1->getGeometryN(i), gc2->getGeometryN(i), tolerance); } ----------------------------------------------------------------------- Summary of changes: tests/unit/utility.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 24 15:03:11 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 24 Mar 2026 15:03:11 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 4efe878b1291ccc7bb80ab976c35559a8883589d Message-ID: <20260324220312.02C2A36B40@trac.osgeo.org> 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 4efe878b1291ccc7bb80ab976c35559a8883589d (commit) from c7d3c151f0e39faac66091a3ad4510eea6754eba (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 4efe878b1291ccc7bb80ab976c35559a8883589d Author: Mike Taves Date: Wed Mar 25 11:02:45 2026 +1300 Label pushes to 'main' branch as 'latest'; remove sha prefix diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 0c755d659..42a93ec20 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -33,10 +33,11 @@ jobs: images: ghcr.io/libgeos/geosop # generate Docker tags based on the following events/attributes tags: | - type=ref,event=branch + # set latest tag for main branch + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} - type=sha + type=sha,prefix= - name: Login to GitHub Container Registry uses: docker/login-action at v4 ----------------------------------------------------------------------- Summary of changes: .github/workflows/container.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 05:55:53 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 05:55:53 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 8d904e8a1d4fb5e79deb2808987363df2dc71c12 Message-ID: <20260325125553.781013C58F@trac.osgeo.org> 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 8d904e8a1d4fb5e79deb2808987363df2dc71c12 (commit) from 4efe878b1291ccc7bb80ab976c35559a8883589d (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 8d904e8a1d4fb5e79deb2808987363df2dc71c12 Author: Daniel Baston Date: Wed Mar 25 08:55:29 2026 -0400 GEOSNode: Avoid crash on collection with empty components (#1410) Resolves https://github.com/libgeos/geos/issues/1406 diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp index cab42cb03..7580b6e07 100644 --- a/src/noding/GeometryNoder.cpp +++ b/src/noding/GeometryNoder.cpp @@ -66,6 +66,10 @@ public: void filter_ro(const geom::Geometry* g) override { + if (g->isEmpty()) { + return; + } + if(const auto* ls = dynamic_cast(g)) { auto coord = ls->getSharedCoordinates(); auto ss = std::make_unique(coord, _constructZ, _constructM, nullptr); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index c5be746b5..e1356e44e 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -355,5 +355,17 @@ void object::test<16>() reinterpret_cast(expected_), 1e-4); } +template<> +template<> +void object::test<17>() +{ + set_test_name("GeometryCollection with empty element"); + + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((0 0, 1 1, 0 1, 0 0)))"); + + result_ = GEOSNode(input_); + ensure(result_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/GeometryNoder.cpp | 4 ++++ tests/unit/capi/GEOSNodeTest.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 05:58:27 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 05:58:27 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.14 updated. 03d50b54fd00017c74d34ba44a4378440a185061 Message-ID: <20260325125827.5E74E3C31D@trac.osgeo.org> 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, 3.14 has been updated via 03d50b54fd00017c74d34ba44a4378440a185061 (commit) from a2e484ca26a8c2a896452f0d8247c4b83e08f4e2 (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 03d50b54fd00017c74d34ba44a4378440a185061 Author: Daniel Baston Date: Wed Mar 25 08:51:17 2026 -0400 GEOSNode: Avoid crash on collection with empty components diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp index 71ad91ea9..b8d773030 100644 --- a/src/noding/GeometryNoder.cpp +++ b/src/noding/GeometryNoder.cpp @@ -59,6 +59,10 @@ public: void filter_ro(const geom::Geometry* g) override { + if (g->isEmpty()) { + return; + } + const geom::LineString* ls = dynamic_cast(g); if(ls) { auto coord = ls->getCoordinates(); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index 41324bda5..4c315e307 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -208,5 +208,17 @@ void object::test<9>() ensure("curved geometries not supported", result_ == nullptr); } +template<> +template<> +void object::test<17>() +{ + set_test_name("GeometryCollection with empty element"); + + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((0 0, 1 1, 0 1, 0 0)))"); + + result_ = GEOSNode(input_); + ensure(result_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/GeometryNoder.cpp | 4 ++++ tests/unit/capi/GEOSNodeTest.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 06:08:27 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 06:08:27 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.12 updated. a8df87a0ff1989e8b3b088e25785ee7a0e4769a6 Message-ID: <20260325130828.0CA893C212@trac.osgeo.org> 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, 3.12 has been updated via a8df87a0ff1989e8b3b088e25785ee7a0e4769a6 (commit) from 19857cafbc79e8e9d35154ff1b709ab5d61e14ae (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 a8df87a0ff1989e8b3b088e25785ee7a0e4769a6 Author: Daniel Baston Date: Wed Mar 25 08:51:17 2026 -0400 GEOSNode: Avoid crash on collection with empty components diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp index 144d1f306..7ac2a0617 100644 --- a/src/noding/GeometryNoder.cpp +++ b/src/noding/GeometryNoder.cpp @@ -59,6 +59,10 @@ public: void filter_ro(const geom::Geometry* g) override { + if (g->isEmpty()) { + return; + } + const geom::LineString* ls = dynamic_cast(g); if(ls) { auto coord = ls->getCoordinates(); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index abda612bb..8c1da4f5f 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -201,5 +201,17 @@ void object::test<8> GEOSFree(wkt_expected); } +template<> +template<> +void object::test<17>() +{ + set_test_name("GeometryCollection with empty element"); + + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((0 0, 1 1, 0 1, 0 0)))"); + + result_ = GEOSNode(input_); + ensure(result_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/GeometryNoder.cpp | 4 ++++ tests/unit/capi/GEOSNodeTest.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 06:09:15 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 06:09:15 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.13 updated. 1d2f7a27e98237776e365c25e4ab7b2a34370ff9 Message-ID: <20260325130915.C43803C1BC@trac.osgeo.org> 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, 3.13 has been updated via 1d2f7a27e98237776e365c25e4ab7b2a34370ff9 (commit) from 938dcf7d376144e8cdcde79a424feabff94ea413 (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 1d2f7a27e98237776e365c25e4ab7b2a34370ff9 Author: Daniel Baston Date: Wed Mar 25 09:08:54 2026 -0400 GEOSNode: Avoid crash on collection with empty components (#1411) diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp index 71ad91ea9..b8d773030 100644 --- a/src/noding/GeometryNoder.cpp +++ b/src/noding/GeometryNoder.cpp @@ -59,6 +59,10 @@ public: void filter_ro(const geom::Geometry* g) override { + if (g->isEmpty()) { + return; + } + const geom::LineString* ls = dynamic_cast(g); if(ls) { auto coord = ls->getCoordinates(); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index 9b11e1a15..a4c715710 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -213,5 +213,17 @@ void object::test<9>() ensure("curved geometries not supported", result_ == nullptr); } +template<> +template<> +void object::test<17>() +{ + set_test_name("GeometryCollection with empty element"); + + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((0 0, 1 1, 0 1, 0 0)))"); + + result_ = GEOSNode(input_); + ensure(result_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/GeometryNoder.cpp | 4 ++++ tests/unit/capi/GEOSNodeTest.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 06:11:27 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 06:11:27 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch 3.11 updated. 0576a1fd2a49ef2c7b1abc7245e769565b169b02 Message-ID: <20260325131127.C484C3C71C@trac.osgeo.org> 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, 3.11 has been updated via 0576a1fd2a49ef2c7b1abc7245e769565b169b02 (commit) from b3e1169efeb6eb02f9f442bb66226f24d346b83a (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 0576a1fd2a49ef2c7b1abc7245e769565b169b02 Author: Daniel Baston Date: Wed Mar 25 08:51:17 2026 -0400 GEOSNode: Avoid crash on collection with empty components diff --git a/src/noding/GeometryNoder.cpp b/src/noding/GeometryNoder.cpp index 5d98cdb19..8e51a2857 100644 --- a/src/noding/GeometryNoder.cpp +++ b/src/noding/GeometryNoder.cpp @@ -55,6 +55,10 @@ public: void filter_ro(const geom::Geometry* g) override { + if (g->isEmpty()) { + return; + } + const geom::LineString* ls = dynamic_cast(g); if(ls) { auto coord = ls->getCoordinates(); diff --git a/tests/unit/capi/GEOSNodeTest.cpp b/tests/unit/capi/GEOSNodeTest.cpp index 0c280450d..0c8258989 100644 --- a/tests/unit/capi/GEOSNodeTest.cpp +++ b/tests/unit/capi/GEOSNodeTest.cpp @@ -124,5 +124,17 @@ void object::test<5> ensure_equals(out, "LINESTRING EMPTY"); } +template<> +template<> +void object::test<17>() +{ + set_test_name("GeometryCollection with empty element"); + + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((0 0, 1 1, 0 1, 0 0)))"); + + result_ = GEOSNode(input_); + ensure(result_); +} + } // namespace tut ----------------------------------------------------------------------- Summary of changes: src/noding/GeometryNoder.cpp | 4 ++++ tests/unit/capi/GEOSNodeTest.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) hooks/post-receive -- GEOS From git at osgeo.org Wed Mar 25 15:47:55 2026 From: git at osgeo.org (git at osgeo.org) Date: Wed, 25 Mar 2026 15:47:55 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. ab9c66697bbbead12c8519c8b2e331394ae99c33 Message-ID: <20260325224755.8B8E83D368@trac.osgeo.org> 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 ab9c66697bbbead12c8519c8b2e331394ae99c33 (commit) from 8d904e8a1d4fb5e79deb2808987363df2dc71c12 (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 ab9c66697bbbead12c8519c8b2e331394ae99c33 Author: Mike Taves Date: Thu Mar 26 11:40:23 2026 +1300 CI: Make a wrapper 'geosopw' in container to show seg faults diff --git a/tools/ci/geosop/Dockerfile b/tools/ci/geosop/Dockerfile index a20b783bf..ed3ce83b5 100644 --- a/tools/ci/geosop/Dockerfile +++ b/tools/ci/geosop/Dockerfile @@ -35,4 +35,8 @@ RUN apk add --no-cache libstdc++ COPY --from=builder /install/bin/geosop /usr/local/bin/geosop COPY --from=builder /install/lib/libgeos.* /usr/local/lib/ -ENTRYPOINT ["geosop"] +# Make a wrapper 'geosopw' to show e.g. 'Segmentation fault (core dumped)' +RUN printf "#!/bin/sh\ngeosop \"\$@\"\n" > /usr/local/bin/geosopw && \ + chmod +x /usr/local/bin/geosopw + +ENTRYPOINT ["geosopw"] ----------------------------------------------------------------------- Summary of changes: tools/ci/geosop/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) hooks/post-receive -- GEOS From git at osgeo.org Mon Mar 30 06:26:24 2026 From: git at osgeo.org (git at osgeo.org) Date: Mon, 30 Mar 2026 06:26:24 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. efa5d0ff93d7a49a135b3ad9816247f01efe9b47 Message-ID: <20260330132624.4EED51135D0@trac.osgeo.org> 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 efa5d0ff93d7a49a135b3ad9816247f01efe9b47 (commit) from ab9c66697bbbead12c8519c8b2e331394ae99c33 (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 efa5d0ff93d7a49a135b3ad9816247f01efe9b47 Author: Even Rouault Date: Mon Mar 30 15:25:52 2026 +0200 Doc of GEOSConcaveHullOfPolygons(): document isTight and isHolesAllowed? (#1415) * Doc of GEOSConcaveHullOfPolygons(): document isTight and isHolesAllowed in the order where they are expected by the function This will avoid confusion such as https://github.com/qgis/QGIS/pull/65596/changes#diff-ef1a3cc494a81e934d927d5e020f4bfe3acc1caddf7707d215db1981deaf8808R1955 inverting the order w.r.t GEOS * Update capi/geos_c.h.in Co-authored-by: Andrea Giudiceandrea --------- Co-authored-by: Dan Baston Co-authored-by: Andrea Giudiceandrea diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 4637c5ab4..1116b0024 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -3359,9 +3359,9 @@ extern char GEOS_DLL GEOSHasM(const GEOSGeometry* g); * A closed geometry is either: * - a non-empty LineString, CircularString, or CompoundCurve whose * start and end points having the same XY values; or -* - a non-empty MultiLineString or MultiCurve whose elements are +* - a non-empty MultiLineString or MultiCurve whose elements are * all closed. -* +* * Z and M values are not considered. * * \param g The geometry to test @@ -3635,7 +3635,7 @@ extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine(const GEOSGeometry* g); * result in an invalid geometry being returned. Be sure * to check and repair validity. * -* Z and M coordinate values are preserved but are not considered when +* Z and M coordinate values are preserved but are not considered when * determining if a point is repeated. * * \return A geometry with all points within the tolerance of each other removed. @@ -4387,7 +4387,7 @@ extern void GEOS_DLL GEOSClusterInfo_destroy(GEOSClusterInfo* clusters); /** * Buffer a geometry. * The coordinates of the constructed geometry will not have Z or M values. -* +* * \param g The input geometry to be buffered. * \param width The distance by which to expand the geometry (or contract) * if the value is negative. @@ -4501,7 +4501,7 @@ extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams( /** * Generate a buffer using the provided style parameters. * The coordinates of the constructed geometry will not have Z or M values. -* +* * \param g The geometry to buffer * \param width Width of the buffer * \param quadsegs Number of segments per quadrant @@ -4918,8 +4918,8 @@ extern GEOSGeometry GEOS_DLL *GEOSConcaveHullByLength( * This normalizes the Maximum Edge Length to be scale-free. * A value of 1 produces the convex hull; a value of 0 produces * the original polygons. +* \param isTight does the hull follow the outer boundaries of the input polygons? * \param isHolesAllowed is the concave hull allowed to contain holes? -* \param isTight does the hull follow the outer boundaries of the input polygons. * \return A newly allocated geometry of the concave hull. NULL on exception. * * Caller is responsible for freeing with GEOSGeom_destroy(). @@ -5184,7 +5184,7 @@ enum GEOSVoronoiFlags }; /** -* Returns the 2D Voronoi polygons or edges computed from the vertices +* Returns the 2D Voronoi polygons or edges computed from the vertices * of the given geometry. * * \param g the input geometry whose vertices will be used as sites. ----------------------------------------------------------------------- Summary of changes: capi/geos_c.h.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 31 09:27:38 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 31 Mar 2026 09:27:38 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 2841a0dc9c1931f4ca78701476c87b8cd3f41b58 Message-ID: <20260331162739.0B8401356E1@trac.osgeo.org> 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 2841a0dc9c1931f4ca78701476c87b8cd3f41b58 (commit) via 38c0f66df4b3c029add23d701cacd72cf08044e5 (commit) from efa5d0ff93d7a49a135b3ad9816247f01efe9b47 (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 2841a0dc9c1931f4ca78701476c87b8cd3f41b58 Author: Daniel Baston Date: Fri Mar 27 11:31:31 2026 -0400 geos_unit: avoid checking isValid / isSimple on curves diff --git a/tests/unit/utility.h b/tests/unit/utility.h index a9003be56..a4f522831 100644 --- a/tests/unit/utility.h +++ b/tests/unit/utility.h @@ -227,18 +227,20 @@ ensure_equals_geometry(T const* lhs_in, T const* rhs_in, double tolerance = 0.0) lhs->normalize(); rhs->normalize(); - ensure_equals("is-valid do not match", - lhs->isValid(), rhs->isValid()); + if (!lhs->hasCurvedComponents() && !rhs->hasCurvedComponents()) { + if(!isInstanceOf(lhs.get()) && + !isInstanceOf(rhs.get())) { + ensure_equals("is-simple do not match", + lhs->isSimple(), rhs->isSimple()); + } + + ensure_equals("is-valid do not match", + lhs->isValid(), rhs->isValid()); + } ensure_equals("is-empty do not match", lhs->isEmpty(), rhs->isEmpty()); - if(!isInstanceOf(lhs.get()) && - !isInstanceOf(rhs.get())) { - ensure_equals("is-simple do not match", - lhs->isSimple(), rhs->isSimple()); - } - ensure_equals("type do not match", lhs->getGeometryType(), rhs->getGeometryType()); commit 38c0f66df4b3c029add23d701cacd72cf08044e5 Author: Daniel Baston Date: Fri Mar 27 11:30:58 2026 -0400 Surface: add clone() diff --git a/include/geos/geom/Surface.h b/include/geos/geom/Surface.h index 35e0d9cf1..d2e401f36 100644 --- a/include/geos/geom/Surface.h +++ b/include/geos/geom/Surface.h @@ -49,6 +49,8 @@ public: void apply_rw(const CoordinateFilter* filter) override; + std::unique_ptr clone() const; + std::unique_ptr convexHull() const override; bool diff --git a/src/geom/Surface.cpp b/src/geom/Surface.cpp index 9a5d66277..37a41386b 100644 --- a/src/geom/Surface.cpp +++ b/src/geom/Surface.cpp @@ -101,6 +101,12 @@ Surface::apply_rw(GeometryFilter* filter) filter->filter_rw(this); } +std::unique_ptr +Surface::clone() const +{ + return std::unique_ptr(detail::down_cast(cloneImpl())); +} + int Surface::compareToSameClass(const Geometry* g) const { ----------------------------------------------------------------------- Summary of changes: include/geos/geom/Surface.h | 2 ++ src/geom/Surface.cpp | 6 ++++++ tests/unit/utility.h | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 31 12:20:21 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 31 Mar 2026 12:20:21 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 8b2ee5e04ea2f3d9b088505cb12d270fa805c51f Message-ID: <20260331192021.69249135DCA@trac.osgeo.org> 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 8b2ee5e04ea2f3d9b088505cb12d270fa805c51f (commit) from 2841a0dc9c1931f4ca78701476c87b8cd3f41b58 (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 8b2ee5e04ea2f3d9b088505cb12d270fa805c51f Author: Daniel Baston Date: Tue Mar 31 15:20:01 2026 -0400 PlanarGraph: Avoid unnecessary use of 3D coordinates (#1417) diff --git a/include/geos/operation/polygonize/EdgeRing.h b/include/geos/operation/polygonize/EdgeRing.h index 18646ee5d..cbfb6fdc7 100644 --- a/include/geos/operation/polygonize/EdgeRing.h +++ b/include/geos/operation/polygonize/EdgeRing.h @@ -154,7 +154,7 @@ public: * @return a Coordinate reference from testPts which is * not in pts, or Coordinate::nullCoord */ - static const geom::Coordinate& ptNotInList( + static const geom::CoordinateXY& ptNotInList( const geom::CoordinateSequence* testPts, const geom::CoordinateSequence* pts); @@ -166,7 +166,7 @@ public: * @param pts an array of Coordinate to test * @return true if the point is in the array */ - static bool isInList(const geom::Coordinate& pt, + static bool isInList(const geom::CoordinateXY& pt, const geom::CoordinateSequence* pts); explicit EdgeRing(const geom::GeometryFactory* newFactory); diff --git a/include/geos/operation/polygonize/PolygonizeDirectedEdge.h b/include/geos/operation/polygonize/PolygonizeDirectedEdge.h index 61b9bff0c..21c61e566 100644 --- a/include/geos/operation/polygonize/PolygonizeDirectedEdge.h +++ b/include/geos/operation/polygonize/PolygonizeDirectedEdge.h @@ -76,7 +76,7 @@ public: */ PolygonizeDirectedEdge(planargraph::Node* newFrom, planargraph::Node* newTo, - const geom::Coordinate& newDirectionPt, + const geom::CoordinateXY& newDirectionPt, bool nEdgeDirection); /* diff --git a/include/geos/operation/polygonize/PolygonizeGraph.h b/include/geos/operation/polygonize/PolygonizeGraph.h index 694f8fe02..e85dbba1b 100644 --- a/include/geos/operation/polygonize/PolygonizeGraph.h +++ b/include/geos/operation/polygonize/PolygonizeGraph.h @@ -137,7 +137,7 @@ private: const geom::GeometryFactory* factory; - planargraph::Node* getNode(const geom::Coordinate& pt); + planargraph::Node* getNode(const geom::CoordinateXY& pt); void computeNextCWEdges(); diff --git a/include/geos/planargraph/DirectedEdge.h b/include/geos/planargraph/DirectedEdge.h index 5d1d44358..e80f9c187 100644 --- a/include/geos/planargraph/DirectedEdge.h +++ b/include/geos/planargraph/DirectedEdge.h @@ -104,7 +104,7 @@ public: * parent Edge (if any) */ DirectedEdge(Node* newFrom, Node* newTo, - const geom::Coordinate& directionPt, + const geom::CoordinateXY& directionPt, bool newEdgeDirection); /** @@ -151,7 +151,7 @@ public: * \brief * Returns the coordinate of the from-node. */ - geom::Coordinate& getCoordinate() const; + geom::CoordinateXY& getCoordinate() const; /** * \brief diff --git a/include/geos/planargraph/DirectedEdgeStar.h b/include/geos/planargraph/DirectedEdgeStar.h index 4ad9e9c3b..e58daa810 100644 --- a/include/geos/planargraph/DirectedEdgeStar.h +++ b/include/geos/planargraph/DirectedEdgeStar.h @@ -27,7 +27,7 @@ // Forward declarations namespace geos { namespace geom { -class Coordinate; +class CoordinateXY; } namespace planargraph { class DirectedEdge; @@ -104,7 +104,7 @@ public: * \brief Returns the coordinate for the node at which this * star is based */ - geom::Coordinate& getCoordinate() const; + geom::CoordinateXY& getCoordinate() const; /** * \brief Returns the DirectedEdges, in ascending order diff --git a/include/geos/planargraph/Node.h b/include/geos/planargraph/Node.h index dccf9781d..48f3751ba 100644 --- a/include/geos/planargraph/Node.h +++ b/include/geos/planargraph/Node.h @@ -45,7 +45,7 @@ class GEOS_DLL Node: public GraphComponent { protected: /// The location of this Node - geom::Coordinate pt; + geom::CoordinateXY pt; /// The collection of DirectedEdges that leave this Node DirectedEdgeStar* deStar; @@ -65,7 +65,7 @@ public: Node* node1); /// Constructs a Node with the given location. - Node(const geom::Coordinate& newPt) + Node(const geom::CoordinateXY& newPt) : pt(newPt) { @@ -92,7 +92,7 @@ public: /** * \brief Returns the location of this Node. */ - geom::Coordinate& + geom::CoordinateXY& getCoordinate() { return pt; diff --git a/include/geos/planargraph/NodeMap.h b/include/geos/planargraph/NodeMap.h index aa39db07b..3e4cc1ea8 100644 --- a/include/geos/planargraph/NodeMap.h +++ b/include/geos/planargraph/NodeMap.h @@ -46,7 +46,7 @@ namespace planargraph { // geos.planargraph */ class GEOS_DLL NodeMap { public: - typedef std::map container; + typedef std::map container; private: container nodeMap; public: @@ -72,14 +72,14 @@ public: * Removes the Node at the given location, and returns it * (or null if no Node was there). */ - Node* remove(geom::Coordinate& pt); + Node* remove(geom::CoordinateXY& pt); /** * \brief * Returns the Node at the given location, * or null if no Node was there. */ - Node* find(const geom::Coordinate& coord); + Node* find(const geom::CoordinateXY& coord); /** * \brief diff --git a/include/geos/planargraph/PlanarGraph.h b/include/geos/planargraph/PlanarGraph.h index fd3037f9e..b047e6d2c 100644 --- a/include/geos/planargraph/PlanarGraph.h +++ b/include/geos/planargraph/PlanarGraph.h @@ -123,7 +123,7 @@ public: * or null if no Node was there. */ Node* - findNode(const geom::Coordinate& pt) + findNode(const geom::CoordinateXY& pt) { return nodeMap.find(pt); } diff --git a/src/operation/buffer/PolygonBuilder.cpp b/src/operation/buffer/PolygonBuilder.cpp index 893847f91..fa0dd46fd 100644 --- a/src/operation/buffer/PolygonBuilder.cpp +++ b/src/operation/buffer/PolygonBuilder.cpp @@ -327,7 +327,7 @@ PolygonBuilder::findEdgeRingContaining(EdgeRing* testEr, } const CoordinateSequence* tsrcs = tryShellRing->getCoordinatesRO(); - const Coordinate& testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs); + const CoordinateXY& testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs); bool isContained = false; if(tryShell.pipLocator->locate(&testPt) != Location::EXTERIOR) { diff --git a/src/operation/polygonize/EdgeRing.cpp b/src/operation/polygonize/EdgeRing.cpp index 937b92497..74457d3e9 100644 --- a/src/operation/polygonize/EdgeRing.cpp +++ b/src/operation/polygonize/EdgeRing.cpp @@ -77,13 +77,13 @@ EdgeRing::findDirEdgesInRing(PolygonizeDirectedEdge* startDE) { } /*public static*/ -const Coordinate& +const CoordinateXY& EdgeRing::ptNotInList(const CoordinateSequence* testPts, const CoordinateSequence* pts) { const std::size_t npts = testPts->getSize(); for(std::size_t i = 0; i < npts; ++i) { - const Coordinate& testPt = testPts->getAt(i); + const CoordinateXY& testPt = testPts->getAt(i); if(!isInList(testPt, pts)) { return testPt; } @@ -93,12 +93,12 @@ EdgeRing::ptNotInList(const CoordinateSequence* testPts, /*public static*/ bool -EdgeRing::isInList(const Coordinate& pt, +EdgeRing::isInList(const CoordinateXY& pt, const CoordinateSequence* pts) { const std::size_t npts = pts->getSize(); for(std::size_t i = 0; i < npts; ++i) { - if(pt == pts->getAt(i)) { + if(pt == pts->getAt(i)) { return true; } } diff --git a/src/operation/polygonize/PolygonizeDirectedEdge.cpp b/src/operation/polygonize/PolygonizeDirectedEdge.cpp index 92e2bc575..c349b0d77 100644 --- a/src/operation/polygonize/PolygonizeDirectedEdge.cpp +++ b/src/operation/polygonize/PolygonizeDirectedEdge.cpp @@ -39,7 +39,7 @@ namespace polygonize { // geos.operation.polygonize * opposite to that of the parent Edge (if any) */ PolygonizeDirectedEdge::PolygonizeDirectedEdge(Node* newFrom, - Node* newTo, const Coordinate& newDirectionPt, + Node* newTo, const CoordinateXY& newDirectionPt, bool nEdgeDirection) : DirectedEdge(newFrom, newTo, diff --git a/src/operation/polygonize/PolygonizeGraph.cpp b/src/operation/polygonize/PolygonizeGraph.cpp index a3c119084..b19de4749 100644 --- a/src/operation/polygonize/PolygonizeGraph.cpp +++ b/src/operation/polygonize/PolygonizeGraph.cpp @@ -139,14 +139,14 @@ PolygonizeGraph::addEdge(const LineString* line) return; } - const Coordinate& startPt = linePts->getAt(0); - const Coordinate& endPt = linePts->getAt(linePts->getSize() - 1); + const CoordinateXY& startPt = linePts->getAt(0); + const CoordinateXY& endPt = linePts->getAt(linePts->getSize() - 1); Node* nStart = getNode(startPt); Node* nEnd = getNode(endPt); DirectedEdge* de0 = new PolygonizeDirectedEdge(nStart, nEnd, linePts->getAt(1), true); newDirEdges.push_back(de0); DirectedEdge* de1 = new PolygonizeDirectedEdge(nEnd, nStart, - linePts->getAt(linePts->getSize() - 2), false); + linePts->getAt(linePts->getSize() - 2), false); newDirEdges.push_back(de1); Edge* edge = new PolygonizeEdge(line); newEdges.push_back(edge); @@ -157,7 +157,7 @@ PolygonizeGraph::addEdge(const LineString* line) } Node* -PolygonizeGraph::getNode(const Coordinate& pt) +PolygonizeGraph::getNode(const CoordinateXY& pt) { Node* node = findNode(pt); if(node == nullptr) { diff --git a/src/planargraph/DirectedEdge.cpp b/src/planargraph/DirectedEdge.cpp index 1f3bfdc36..a6a591624 100644 --- a/src/planargraph/DirectedEdge.cpp +++ b/src/planargraph/DirectedEdge.cpp @@ -48,7 +48,7 @@ DirectedEdge::toEdges(std::vector& dirEdges) /*public*/ DirectedEdge::DirectedEdge(Node* newFrom, Node* newTo, - const Coordinate& directionPt, bool newEdgeDirection) + const CoordinateXY& directionPt, bool newEdgeDirection) { from = newFrom; to = newTo; @@ -112,7 +112,7 @@ DirectedEdge::getToNode() const } /*public*/ -Coordinate& +CoordinateXY& DirectedEdge::getCoordinate() const { return from->getCoordinate(); diff --git a/src/planargraph/DirectedEdgeStar.cpp b/src/planargraph/DirectedEdgeStar.cpp index d95a2f3e4..6dfc5ebab 100644 --- a/src/planargraph/DirectedEdgeStar.cpp +++ b/src/planargraph/DirectedEdgeStar.cpp @@ -81,7 +81,7 @@ DirectedEdgeStar::end() const /* * Returns the coordinate for the node at which this star is based */ -Coordinate& +CoordinateXY& DirectedEdgeStar::getCoordinate() const { if(outEdges.empty()) { diff --git a/src/planargraph/NodeMap.cpp b/src/planargraph/NodeMap.cpp index d889d2b86..6729a22f4 100644 --- a/src/planargraph/NodeMap.cpp +++ b/src/planargraph/NodeMap.cpp @@ -52,7 +52,7 @@ NodeMap::add(Node* n) * (or null if no Node was there). */ Node* -NodeMap::remove(geom::Coordinate& pt) +NodeMap::remove(geom::CoordinateXY& pt) { Node* n = find(pt); nodeMap.erase(pt); @@ -74,7 +74,7 @@ NodeMap::getNodes(std::vector& values) * Returns the Node at the given location, or null if no Node was there. */ Node* -NodeMap::find(const geom::Coordinate& coord) +NodeMap::find(const geom::CoordinateXY& coord) { container::iterator found = nodeMap.find(coord); if(found == nodeMap.end()) { ----------------------------------------------------------------------- Summary of changes: include/geos/operation/polygonize/EdgeRing.h | 4 ++-- include/geos/operation/polygonize/PolygonizeDirectedEdge.h | 2 +- include/geos/operation/polygonize/PolygonizeGraph.h | 2 +- include/geos/planargraph/DirectedEdge.h | 4 ++-- include/geos/planargraph/DirectedEdgeStar.h | 4 ++-- include/geos/planargraph/Node.h | 6 +++--- include/geos/planargraph/NodeMap.h | 6 +++--- include/geos/planargraph/PlanarGraph.h | 2 +- src/operation/buffer/PolygonBuilder.cpp | 2 +- src/operation/polygonize/EdgeRing.cpp | 8 ++++---- src/operation/polygonize/PolygonizeDirectedEdge.cpp | 2 +- src/operation/polygonize/PolygonizeGraph.cpp | 8 ++++---- src/planargraph/DirectedEdge.cpp | 4 ++-- src/planargraph/DirectedEdgeStar.cpp | 2 +- src/planargraph/NodeMap.cpp | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 31 15:27:05 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 31 Mar 2026 15:27:05 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. be17b189a8accbf68d5f76f8b45237fd2307011c Message-ID: <20260331222711.3C576135D6A@trac.osgeo.org> 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 be17b189a8accbf68d5f76f8b45237fd2307011c (commit) via 224d1448e5086c2f0017c4c58b05a25823d27173 (commit) from 8b2ee5e04ea2f3d9b088505cb12d270fa805c51f (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 be17b189a8accbf68d5f76f8b45237fd2307011c Author: Paul Ramsey Date: Tue Mar 31 15:23:11 2026 -0700 Add extern size_t GEOS_DLL *GEOSMinimumSpanningTree(const GEOSGeometry * const geoms[], unsigned int ngeoms); for an input set of LineString, build a connected graph using start/end points as nodes, and calculate the Minimum Spanning Tree for the graph, returning for each input LineString a non-zero number of the edge is in the MST and zero otherwise. Different non-zero numbers correspond to member ship in different MST of unconnected regions of the graph. diff --git a/capi/geos_c.cpp b/capi/geos_c.cpp index 54d29bba9..1341f6365 100644 --- a/capi/geos_c.cpp +++ b/capi/geos_c.cpp @@ -1123,6 +1123,12 @@ extern "C" { return GEOSLineMerge_r(handle, g); } + std::size_t* + GEOSMinimumSpanningTree(const Geometry* const* geoms, unsigned int ngeoms) + { + return GEOSMinimumSpanningTree_r(handle, geoms, ngeoms); + } + Geometry* GEOSLineMergeDirected(const Geometry* g) { diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index b38029835..2c21576fc 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -1229,6 +1229,12 @@ extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r( GEOSContextHandle_t handle, const GEOSGeometry* g); +/** \see GEOSMinimumSpanningTree */ +extern size_t GEOS_DLL *GEOSMinimumSpanningTree_r( + GEOSContextHandle_t handle, + const GEOSGeometry * const geoms[], + unsigned int ngeoms); + /** \see GEOSLineMergeDirected */ extern GEOSGeometry GEOS_DLL *GEOSLineMergeDirected_r( GEOSContextHandle_t handle, @@ -5413,8 +5419,25 @@ extern GEOSGeometry GEOS_DLL *GEOSDensify( extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g); /** -* Merges a set of LineStrings, -* joining them at nodes which have cardinality 2. + * Computes the Minimum Spanning Tree of the given Curves. + * + * The input is an array of Curves (LineString, CircularString, CompoundCurve) + * which form the edges of a graph. + * The nodes of the graph are the endpoints of the Curves. + * Coincident endpoints are treated as the same node. + * + * \param geoms Input array of Curves. Non-Curve geometries are ignored. + * \param ngeoms Number of geometries in the input array. + * \return An array of size_t of size ngeoms. 0 if the edge is not in the MST. + * Values > 0 indicate the component ID of the subtree the edge belongs to. + * The caller is responsible for freeing the returned array using GEOSFree(). + * Returns NULL if ngeoms is 0 or on error. + * \since 3.15.0 + */ +extern size_t GEOS_DLL *GEOSMinimumSpanningTree(const GEOSGeometry * const geoms[], unsigned int ngeoms); + +/** + * Merges a set of LineStrings,* joining them at nodes which have cardinality 2. * and where the lines have the same direction. * This means that lines do not have their direction reversed. * diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index 05c83acdf..d183be9ea 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -85,6 +85,7 @@ #include #include #include +#include #include #include #include @@ -2705,6 +2706,46 @@ extern "C" { }); } + std::size_t* + GEOSMinimumSpanningTree_r(GEOSContextHandle_t extHandle, const Geometry* const* geoms, unsigned int ngeoms) + { + using geos::operation::spanning::SpanningTree; + using geos::geom::Curve; + + if (ngeoms == 0 || geoms == nullptr) { + return nullptr; + } + + return execute(extHandle, [&]() { + std::vector curvevec(ngeoms); + for (unsigned int i = 0; i < ngeoms; ++i) { + if (geoms[i]) { + auto typeId = geoms[i]->getGeometryTypeId(); + if (typeId == geos::geom::GEOS_LINESTRING || + typeId == geos::geom::GEOS_CIRCULARSTRING || + typeId == geos::geom::GEOS_COMPOUNDCURVE) { + curvevec[i] = static_cast(geoms[i]); + } + else { + curvevec[i] = nullptr; + } + } + else { + curvevec[i] = nullptr; + } + } + + std::vector result; + SpanningTree::mst(curvevec, result); + + std::size_t* result_buf = static_cast(malloc(ngeoms * sizeof(std::size_t))); + if (result_buf) { + std::copy(result.begin(), result.end(), result_buf); + } + return result_buf; + }); + } + Geometry* GEOSLineMergeDirected_r(GEOSContextHandle_t extHandle, const Geometry* g) { diff --git a/include/geos/operation/spanning/SpanningTree.h b/include/geos/operation/spanning/SpanningTree.h new file mode 100644 index 000000000..9c35cac37 --- /dev/null +++ b/include/geos/operation/spanning/SpanningTree.h @@ -0,0 +1,59 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 Paul Ramsey + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#pragma once + +#include +#include + +// Forward declarations +namespace geos { +namespace geom { +class Curve; +} +} + +namespace geos { +namespace operation { // geos::operation +namespace spanning { // geos::operation::spanning + +/** \brief + * Constructs a Minimum Spanning Tree (MST) from a set of Curves. + * + * The input is a vector of Curves (LineString, CircularString, CompoundCurve) + * which form the edges of a graph. + * The nodes of the graph are the endpoints of the Curves. + * Coincident endpoints are treated as the same node. + * + * The algorithm uses Kruskal's algorithm to find the MST. + */ +class GEOS_DLL SpanningTree { + +public: + + /** \brief + * Computes the Minimum Spanning Tree of the given Curves. + * + * @param curves Input vector of Curves. + * @param result Output vector of size_t. 0 if the edge is not in the MST. + * Values > 0 indicate the component ID of the subtree the edge belongs to. + * The vector will be resized to match the input size. + */ + static void mst(const std::vector& curves, std::vector& result); + +}; + +} // namespace geos::operation::spanning +} // namespace geos::operation +} // namespace geos diff --git a/src/operation/spanning/SpanningTree.cpp b/src/operation/spanning/SpanningTree.cpp new file mode 100644 index 000000000..41c12abf6 --- /dev/null +++ b/src/operation/spanning/SpanningTree.cpp @@ -0,0 +1,159 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 Paul Ramsey + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace geos::geom; + +namespace geos { +namespace operation { // geos::operation +namespace spanning { // geos::operation::spanning + +namespace { + + // Internal edge representation for Kruskal's + struct MSTEdge { + std::size_t u; + std::size_t v; + double weight; + std::size_t originalIndex; + }; + + // Union-Find data structure using vector for efficiency + struct UnionFind { + std::vector parent; + std::vector rank; + + UnionFind(std::size_t n) : parent(n), rank(n, 0) { + std::iota(parent.begin(), parent.end(), 0); + } + + std::size_t find(std::size_t i) { + if (parent[i] == i) + return i; + else + parent[i] = find(parent[i]); + return parent[i]; // path compression + } + + bool unite(std::size_t i, std::size_t j) { + std::size_t root_i = find(i); + std::size_t root_j = find(j); + if (root_i != root_j) { + // Union by rank + if (rank[root_i] < rank[root_j]) + parent[root_i] = root_j; + else if (rank[root_i] > rank[root_j]) + parent[root_j] = root_i; + else { + parent[root_i] = root_j; + rank[root_j]++; + } + return true; + } + return false; + } + }; + + // Helper for coordinate to node ID mapping + struct NodeMapping { + std::unordered_map coordToId; + + std::size_t getId(const CoordinateXY& c) { + auto it = coordToId.find(c); + if (it != coordToId.end()) return it->second; + std::size_t id = coordToId.size(); + coordToId[c] = id; + return id; + } + + std::size_t size() const { + return coordToId.size(); + } + }; + +} // anonymous namespace + +void +SpanningTree::mst(const std::vector& curves, std::vector& result) +{ + // Resize result to match input and initialize with 0 + result.assign(curves.size(), 0); + if (curves.empty()) return; + + NodeMapping mapping; + std::vector edges; + + for (std::size_t i = 0; i < curves.size(); ++i) { + const Curve* curve = curves[i]; + if (!curve || curve->isEmpty()) continue; + + auto startPoint = curve->getStartPoint(); + auto endPoint = curve->getEndPoint(); + if (!startPoint || !endPoint) continue; + + CoordinateXY startCoord(*(startPoint->getCoordinate())); + CoordinateXY endCoord(*(endPoint->getCoordinate())); + + // Ignore zero-length edges (where start == end in 2D) + if (startCoord.equals2D(endCoord)) continue; + + std::size_t u = mapping.getId(startCoord); + std::size_t v = mapping.getId(endCoord); + double length = curve->getLength(); + + edges.push_back({u, v, length, i}); + } + + if (edges.empty()) return; + + // Sort edges by length + std::sort(edges.begin(), edges.end(), [](const MSTEdge& a, const MSTEdge& b) { + return a.weight < b.weight; + }); + + // Kruskal's algorithm + UnionFind uf(mapping.size()); + std::vector treeEdges; + + for (const auto& edge : edges) { + if (uf.unite(edge.u, edge.v)) { + treeEdges.push_back(&edge); + } + } + + // Assign component IDs + std::size_t componentId = 0; + std::unordered_map rootToComponentId; + + for (const auto* edge : treeEdges) { + std::size_t root = uf.find(edge->u); + if (rootToComponentId.find(root) == rootToComponentId.end()) { + rootToComponentId[root] = ++componentId; + } + result[edge->originalIndex] = rootToComponentId[root]; + } +} + +} // namespace geos::operation::spanning +} // namespace geos::operation +} // namespace geos diff --git a/tests/unit/capi/GEOSMinimumSpanningTreeTest.cpp b/tests/unit/capi/GEOSMinimumSpanningTreeTest.cpp new file mode 100644 index 000000000..ce9b3f3cb --- /dev/null +++ b/tests/unit/capi/GEOSMinimumSpanningTreeTest.cpp @@ -0,0 +1,175 @@ +// +// Test Suite for C-API GEOSMinimumSpanningTree + +#include +// geos +#include + +#include + +#include "capi_test_utils.h" + +namespace tut { +// +// Test Group +// + +// Common data used in test cases. +struct test_capigeosmst_data : public capitest::utility { +}; + +typedef test_group group; +typedef group::object object; + +group test_capigeosmst_group("capi::GEOSMinimumSpanningTree"); + +// +// Test Cases +// + +// Standard case +template<> +template<> +void object::test<1> () +{ + constexpr int size = 3; + GEOSGeometry* geoms[size]; + geoms[0] = GEOSGeomFromWKT("LINESTRING(0 0, 10 0)"); // 10 + geoms[1] = GEOSGeomFromWKT("LINESTRING(10 0, 5 10)"); // ~11.18 + geoms[2] = GEOSGeomFromWKT("LINESTRING(5 10, 0 0)"); // ~11.18 + + size_t* result = GEOSMinimumSpanningTree(geoms, size); + + ensure(nullptr != result); + + int count = 0; + for (int i = 0; i < size; ++i) { + if (result[i] > 0) count++; + } + ensure_equals(count, 2); + ensure(result[0] > 0); // Shortest edge must be in + + // Check component IDs are same + size_t compId = 0; + for (int i = 0; i < size; ++i) { + if (result[i] > 0) { + if (compId == 0) compId = result[i]; + else ensure_equals(result[i], compId); + } + } + + GEOSFree(result); + + for(auto& input : geoms) { + GEOSGeom_destroy(input); + } +} + +// Disconnected graph +template<> +template<> +void object::test<2> () +{ + constexpr int size = 2; + GEOSGeometry* geoms[size]; + geoms[0] = GEOSGeomFromWKT("LINESTRING(0 0, 10 0)"); + geoms[1] = GEOSGeomFromWKT("LINESTRING(20 0, 30 0)"); + + size_t* result = GEOSMinimumSpanningTree(geoms, size); + + ensure(nullptr != result); + ensure(result[0] > 0); + ensure(result[1] > 0); + ensure(result[0] != result[1]); + + GEOSFree(result); + + for(auto& input : geoms) { + GEOSGeom_destroy(input); + } +} + +// Mixed inputs (non-linestrings) +template<> +template<> +void object::test<3> () +{ + constexpr int size = 3; + GEOSGeometry* geoms[size]; + geoms[0] = GEOSGeomFromWKT("LINESTRING(0 0, 10 0)"); + geoms[1] = GEOSGeomFromWKT("POINT(5 5)"); + geoms[2] = GEOSGeomFromWKT("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"); + + size_t* result = GEOSMinimumSpanningTree(geoms, size); + + ensure(nullptr != result); + ensure(result[0] > 0); + ensure_equals(result[1], 0u); + ensure_equals(result[2], 0u); + + GEOSFree(result); + + for(auto& input : geoms) { + GEOSGeom_destroy(input); + } +} + +// Empty input +template<> +template<> +void object::test<4> () +{ + size_t* result = GEOSMinimumSpanningTree(nullptr, 0); + ensure(nullptr == result); +} + +// Null array entries +template<> +template<> +void object::test<5> () +{ + constexpr int size = 2; + GEOSGeometry* geoms[size]; + geoms[0] = GEOSGeomFromWKT("LINESTRING(0 0, 10 0)"); + geoms[1] = 0; + + size_t* result = GEOSMinimumSpanningTree(geoms, size); + + ensure(nullptr != result); + ensure(result[0] > 0); + ensure_equals(result[1], 0u); + + GEOSFree(result); + + GEOSGeom_destroy(geoms[0]); +} + +// Curved inputs +template<> +template<> +void object::test<6> () +{ + constexpr int size = 2; + GEOSGeometry* geoms[size]; + geoms[0] = GEOSGeomFromWKT("CIRCULARSTRING(0 0, 5 5, 10 0)"); + geoms[1] = GEOSGeomFromWKT("COMPOUNDCURVE((10 0, 10 10), CIRCULARSTRING(10 10, 5 15, 0 10), (0 10, 0 0))"); + + size_t* result = GEOSMinimumSpanningTree(geoms, size); + + ensure(nullptr != result); + // Forms a loop, MST should pick one. + + int count = 0; + for (int i = 0; i < size; ++i) { + if (result[i] > 0) count++; + } + ensure_equals(count, 1); + + GEOSFree(result); + + for(auto& input : geoms) { + GEOSGeom_destroy(input); + } +} + +} // namespace tut diff --git a/tests/unit/operation/spanning/SpanningTreeTest.cpp b/tests/unit/operation/spanning/SpanningTreeTest.cpp new file mode 100644 index 000000000..e12fb6052 --- /dev/null +++ b/tests/unit/operation/spanning/SpanningTreeTest.cpp @@ -0,0 +1,308 @@ +// +// Test Suite for geos::operation::spanning::SpanningTree class. + +// tut +#include +// geos +#include +#include +#include +#include +#include +#include +#include +// std +#include +#include +#include +#include +#include + +namespace tut { +// +// Test Group +// + +// Common data used by tests +struct test_spanning_data { + geos::io::WKTReader wktreader; + + test_spanning_data() + : wktreader() + { + } + + std::unique_ptr + readWKT(const std::string& inputWKT) + { + return std::unique_ptr(wktreader.read(inputWKT)); + } + + std::vector + toCurves(const geos::geom::Geometry* geom) { + std::vector curves; + if (const geos::geom::GeometryCollection* gc = dynamic_cast(geom)) { + for (std::size_t i = 0; i < gc->getNumGeometries(); ++i) { + if (const geos::geom::Curve* c = dynamic_cast(gc->getGeometryN(i))) { + curves.push_back(c); + } + } + } else if (const geos::geom::Curve* c = dynamic_cast(geom)) { + curves.push_back(c); + } + return curves; + } +}; + +typedef test_group group; +typedef group::object object; + +group test_spanning_group("geos::operation::spanning::SpanningTree"); + +// +// Test Cases +// + +// Basic triangle test +template<> template<> +void object::test<1>() +{ + // Triangle with side lengths 10, ~11.18, ~11.18 + // MST should pick the shortest edge (10) and one of the others. + // Lengths: + // 0: (0 0, 10 0) -> 10 + // 1: (10 0, 5 10) -> sqrt(25+100) = 11.18 + // 2: (5 10, 0 0) -> sqrt(25+100) = 11.18 + + std::string wkt = "MULTILINESTRING((0 0, 10 0), (10 0, 5 10), (5 10, 0 0))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 3u); + + // Count edges in MST (should be 2) + int count = 0; + for (std::size_t r : result) { + if (r > 0) count++; + } + ensure_equals(count, 2); + + // Edge 0 (length 10) must be included + ensure(result[0] > 0); + + // Component IDs should be the same (connected graph) + std::size_t compId = result[0]; + for (std::size_t r : result) { + if (r > 0) ensure_equals(r, compId); + } +} + +// Disconnected graph +template<> template<> +void object::test<2>() +{ + std::string wkt = "MULTILINESTRING((0 0, 10 0), (20 0, 30 0))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 2u); + ensure(result[0] > 0); + ensure(result[1] > 0); + + // Should be different components + ensure(result[0] != result[1]); +} + +// Complex graph +template<> template<> +void object::test<3>() +{ + std::string wkt = "MULTILINESTRING(" + "(0 0, 10 0), (10 0, 10 10), (10 10, 0 10), (0 10, 0 0), " // 0-3: Sides (10) + "(0 0, 10 10), (10 0, 0 10))"; // 4-5: Diagonals (~14.14) + + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 6u); + + int count = 0; + std::set components; + for (std::size_t r : result) { + if (r > 0) { + count++; + components.insert(r); + } + } + // A square with 2 diagonals has 4 vertices. MST should have 3 edges. + // Wait, 4 edges for square + 2 diagonals = 6 edges. + // Vertices: 4. + // MST edges = Vertices - 1 = 3. + // result should have 3 non-zero entries. + ensure_equals(count, 3); + + // Should be 1 component + ensure_equals(components.size(), 1u); + + // Diagonals should not be included as they are longer + ensure_equals(result[4], 0u); + ensure_equals(result[5], 0u); +} + +// Empty input +template<> template<> +void object::test<4>() +{ + std::vector curves; + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + ensure(result.empty()); +} + +// Null pointers and empty geometries +template<> template<> +void object::test<5>() +{ + auto factory = geos::geom::GeometryFactory::create(); + auto empty = factory->createLineString(); + + std::vector curves; + curves.push_back(nullptr); + curves.push_back(empty.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 2u); + ensure_equals(result[0], 0u); + ensure_equals(result[1], 0u); +} + +// Short lines (zero length) - should be ignored +template<> template<> +void object::test<6>() +{ + std::string wkt = "MULTILINESTRING((0 0, 0 0))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 1u); + ensure_equals(result[0], 0u); +} + +// Loops (start == end) +template<> template<> +void object::test<7>() +{ + std::string wkt = "MULTILINESTRING((0 0, 10 10, 0 0))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 1u); + // A single loop doesn't form a tree with 2 nodes? + // Actually, start and end are the same node. So 1 node, 1 edge. + // Kruskal: find(start) == find(end), so not included. + ensure_equals(result[0], 0u); +} + +// Multi-edges (two edges between same nodes) +template<> template<> +void object::test<8>() +{ + std::string wkt = "MULTILINESTRING((0 0, 10 0), (0 0, 10 0))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + ensure_equals(result.size(), 2u); + // One should be in, one out. + int count = 0; + for (std::size_t r : result) if (r > 0) count++; + ensure_equals(count, 1); +} + +// Mixed Curved geometries +template<> template<> +void object::test<9>() +{ + std::string wkt = "GEOMETRYCOLLECTION(" + "CIRCULARSTRING(0 0, 5 5, 10 0)," + "LINESTRING(10 0, 10 10)," + "COMPOUNDCURVE(CIRCULARSTRING(10 10, 5 15, 0 10), (0 10, 0 0))" + ")"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + ensure_equals(curves.size(), 3u); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + + int count = 0; + for (std::size_t r : result) if (r > 0) count++; + + // Debug: + // for (std::size_t i = 0; i < curves.size(); ++i) { + // std::cout << "Curve " << i << " length=" << curves[i]->getLength() << " result=" << result[i] << std::endl; + // } + + // Geometries: + // C0: (0,0) -> (10,0) via (5,5). Length: PI*5 ~= 15.7 + // C1: (10,0) -> (10,10). Length: 10 + // C2: (10,10) -> (0,0) via (5,15) and (0,10). + // Part 1: (10,10) -> (0,10) via (5,15). Length: PI*5 ~= 15.7 + // Part 2: (0,10) -> (0,0). Length: 10 + // Total C2 length ~= 25.7 + + // Nodes: (0,0), (10,0), (10,10). + // Wait, (0,10) is NOT a node because it's INTERNAL to COMPOUNDCURVE C2. + // So we have 3 nodes: N0(0,0), N1(10,0), N2(10,10). + // Edges: + // E0: N0-N1 (Length 15.7) + // E1: N1-N2 (Length 10) + // E2: N2-N0 (Length 25.7) + + // MST should pick E1 (10) and E0 (15.7). Total 2 edges. + // My expectation of 3 was wrong because I thought there were 4 nodes. + ensure_equals(count, 2); +} + +// Simple square +template<> template<> +void object::test<10>() +{ + std::string wkt = "MULTILINESTRING((0 0,1 0),(1 1,1 0),(0 0,1 1),(0 0,0 1),(1 1,0 1),(1 0,0 1))"; + auto geom = readWKT(wkt); + auto curves = toCurves(geom.get()); + + std::vector result; + geos::operation::spanning::SpanningTree::mst(curves, result); + ensure_equals(result.size(), 6u); + // MULTILINESTRING((0 0,1 0),(1 1,1 0),(0 0,0 1)) + + int count = 0; + for (std::size_t r : result) { + //std::cout << r << std::endl; + if (r > 0) count++; + } + ensure_equals(count, 3); +} + + +} // namespace tut commit 224d1448e5086c2f0017c4c58b05a25823d27173 Author: Paul Ramsey Date: Tue Mar 31 15:16:07 2026 -0700 Squashed commit of the following: commit b3c8a8b4d269c9359c3cec2f5fdfac4e6626d3ec Merge: cc404b809 8b2ee5e04 Author: Paul Ramsey Date: Tue Mar 31 15:11:14 2026 -0700 Merge branch 'main' into main-coverage-edges commit cc404b80924b97eed4b3ff43ea0c7ae312696b32 Author: Paul Ramsey Date: Tue Mar 31 13:44:42 2026 -0700 change API slightly commit bb1bfbcc25ae194d82d32a4d108102959fa9f804 Author: Paul Ramsey Date: Mon Mar 30 16:59:09 2026 -0700 CoverageEdges first draft Add extern GEOSGeometry GEOS_DLL *GEOSCoverageEdges(const GEOSGeometry *input, int edgetype) which returns the edges of a polygonal coverage. With edgetype == 0 all edges are returned, edgetype == 1 just exterior, edgetype == 2 just interior edges. diff --git a/NEWS.md b/NEWS.md index 3f8bf9b43..79fb62aa5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ 2026-xx-xx - New things: + - Add GEOSCoverageEdges (Paul Ramsey) - Add new C API functions for Hausdorff distance (GH-1352, Sven Jensen) - Add GEOSSubdivideByGrid (GH-1232, Dan Baston) diff --git a/capi/geos_c.cpp b/capi/geos_c.cpp index e74070e3e..54d29bba9 100644 --- a/capi/geos_c.cpp +++ b/capi/geos_c.cpp @@ -1100,6 +1100,15 @@ extern "C" { handle, input); } + GEOSGeometry * + GEOSCoverageEdges( + const GEOSGeometry * input, + int edgetype) + { + return GEOSCoverageEdges_r( + handle, input, edgetype); + } + Geometry* GEOSRemoveRepeatedPoints( const Geometry* g, diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in index 1116b0024..b38029835 100644 --- a/capi/geos_c.h.in +++ b/capi/geos_c.h.in @@ -938,6 +938,13 @@ GEOSCoverageSimplifyVW_r( double tolerance, int preserveBoundary); +/** \see GEOSCoverageEdges */ +extern GEOSGeometry GEOS_DLL * +GEOSCoverageEdges_r( + GEOSContextHandle_t handle, + const GEOSGeometry* input, + int edgetype); + /** \see GEOSCoverageCleanParams_create */ extern GEOSCoverageCleanParams GEOS_DLL * GEOSCoverageCleanParams_create_r( @@ -4630,8 +4637,18 @@ extern GEOSGeometry GEOS_DLL * GEOSCoverageSimplifyVW( int preserveBoundary); /** -* Create a default GEOSCoverageCleanParams object for controlling -* the way invalid polygon interactions are repaired by \ref GEOSCoverageCleanWithParams. + * Returns a MultiLineString representing the unique edges of a polygonal coverage. + * + * \param input a GeometryCollection or MultiPolygon representing the coverage. + * \param edgetype selection type: 0 = ALL, 1 = EXTERIOR (non-shared), 2 = INTERIOR (shared). + * \return a MultiLineString of unique edges, or NULL on error. + * + * \since 3.15 + */ +extern GEOSGeometry GEOS_DLL *GEOSCoverageEdges(const GEOSGeometry *input, int edgetype); + +/** + * Create a default GEOSCoverageCleanParams object for controlling* the way invalid polygon interactions are repaired by \ref GEOSCoverageCleanWithParams. * \return A newly allocated GEOSCoverageCleanParams. NULL on exception. * Caller is responsible for freeing with GEOSCoverageCleanParams_destroy(). * diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp index e57a00343..05c83acdf 100644 --- a/capi/geos_ts_c.cpp +++ b/capi/geos_ts_c.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -4817,5 +4818,16 @@ extern "C" { return GEOSCoverageCleanWithParams_r(extHandle, input, nullptr); } + GEOSGeometry * + GEOSCoverageEdges_r(GEOSContextHandle_t extHandle, + const GEOSGeometry* input, + int edgetype) + { + using geos::coverage::CoverageEdges; + + return execute(extHandle, [&]() -> Geometry* { + return CoverageEdges::GetEdges(input, edgetype).release(); + }); + } } /* extern "C" */ diff --git a/include/geos/coverage/CoverageEdges.h b/include/geos/coverage/CoverageEdges.h new file mode 100644 index 000000000..b1b6a847a --- /dev/null +++ b/include/geos/coverage/CoverageEdges.h @@ -0,0 +1,61 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 Paul Ramsey + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#pragma once + +#include +#include +#include + +// Forward declarations +namespace geos { +namespace geom { +class Geometry; +} +} + +namespace geos { // geos +namespace coverage { // geos::coverage + +/** + * Utility to extract unique edges from a polygonal coverage. + * + * @author Paul Ramsey + * + */ +class GEOS_DLL CoverageEdges { +public: + + /** + * Returns a MultiLineString representing the unique edges of a polygonal coverage. + * + * @param coverage a vector of polygons in the coverage + * @param type selection type: 0 = ALL, 1 = EXTERIOR (non-shared), 2 = INTERIOR (shared) + * @return a MultiLineString of unique edges + */ + static std::unique_ptr GetEdges(const std::vector& coverage, int type = 0); + + /** + * Returns a MultiLineString representing the unique edges of a polygonal coverage. + * + * @param coverage a GeometryCollection or MultiPolygon representing the coverage + * @param type selection type: 0 = ALL, 1 = EXTERIOR (non-shared), 2 = INTERIOR (shared) + * @return a MultiLineString of unique edges + */ + static std::unique_ptr GetEdges(const geom::Geometry* coverage, int type = 0); + +}; + +} // namespace geos::coverage +} // namespace geos diff --git a/src/coverage/CoverageEdges.cpp b/src/coverage/CoverageEdges.cpp new file mode 100644 index 000000000..3c2dd6933 --- /dev/null +++ b/src/coverage/CoverageEdges.cpp @@ -0,0 +1,76 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2026 Paul Ramsey + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +namespace geos { // geos +namespace coverage { // geos::coverage + +/* public static */ +std::unique_ptr +CoverageEdges::GetEdges(const std::vector& coverage, int type) +{ + if (coverage.empty()) { + return nullptr; + } + + const geom::GeometryFactory* factory = coverage[0]->getFactory(); + CoverageRingEdges cre(coverage); + std::vector selectedEdges; + + for (auto* edge : cre.getEdges()) { + if (type == 2) { // INTERIOR + if (edge->getRingCount() > 1) + selectedEdges.push_back(edge); + } + else if (type == 1) { // EXTERIOR + if (edge->getRingCount() == 1) + selectedEdges.push_back(edge); + } + else { // ALL (0 and default) + selectedEdges.push_back(edge); + } + } + + return CoverageEdge::createLines(selectedEdges, factory); +} + +/* public static */ +std::unique_ptr +CoverageEdges::GetEdges(const geom::Geometry* input, int type) +{ + std::vector polygons; + geom::util::PolygonExtracter::getPolygons(*input, polygons); + + if (polygons.empty()) { + return input->getFactory()->createMultiLineString(); + } + + std::vector coverage; + for (const auto* poly : polygons) { + coverage.push_back(poly); + } + + return GetEdges(coverage, type); +} + + +} // namespace geos::coverage +} // namespace geos diff --git a/tests/unit/capi/GEOSCoverageEdgesTest.cpp b/tests/unit/capi/GEOSCoverageEdgesTest.cpp new file mode 100644 index 000000000..c2ca7046d --- /dev/null +++ b/tests/unit/capi/GEOSCoverageEdgesTest.cpp @@ -0,0 +1,51 @@ +// +// Test Suite for GEOSCoverageEdges CAPI function. + +#include +// geos +#include + +#include "capi_test_utils.h" + +namespace tut { +// +// Test Group +// + +// Common data used by all tests +struct test_geoscoverageedges_data : public capitest::utility + { + test_geoscoverageedges_data() {} +}; + +typedef test_group group; +typedef group::object object; + +group test_geoscoverageedges_data("capi::GEOSCoverageEdges"); + + +// testTwoAdjacentInterior +template<> +template<> +void object::test<1> () +{ + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON ((1 1, 1 6, 6 5, 9 6, 9 1, 1 1)), POLYGON ((1 9, 6 9, 6 5, 1 6, 1 9)))"); + result_ = GEOSCoverageEdges(input_, 2); // INTERIOR + expected_ = fromWKT("MULTILINESTRING ((1 6, 6 5))"); + + ensure_geometry_equals(result_, expected_); +} + +// testTwoAdjacentExterior +template<> +template<> +void object::test<2> () +{ + input_ = fromWKT("GEOMETRYCOLLECTION (POLYGON ((1 1, 1 6, 6 5, 9 6, 9 1, 1 1)), POLYGON ((1 9, 6 9, 6 5, 1 6, 1 9)))"); + result_ = GEOSCoverageEdges(input_, 1); // EXTERIOR + expected_ = fromWKT("MULTILINESTRING ((1 6, 1 1, 9 1, 9 6, 6 5), (1 6, 1 9, 6 9, 6 5))"); + + ensure_geometry_equals(result_, expected_); +} + +} // namespace tut diff --git a/tests/unit/coverage/CoverageEdgesTest.cpp b/tests/unit/coverage/CoverageEdgesTest.cpp new file mode 100644 index 000000000..1f3f520da --- /dev/null +++ b/tests/unit/coverage/CoverageEdgesTest.cpp @@ -0,0 +1,113 @@ +// +// Test Suite for geos::coverage::CoverageEdges class. + +#include +#include + +// geos +#include +#include + +using geos::coverage::CoverageEdges; + +namespace tut { +// +// Test Group +// + +// Common data used by all tests +struct test_coverageedges_data + { + + WKTReader r; + WKTWriter w; + + test_coverageedges_data() { + } + + void + checkEdges(const std::string& wkt, int type, const std::string& wktExpected) + { + std::unique_ptr geom = r.read(wkt); + std::unique_ptr edgeLines = CoverageEdges::GetEdges(geom.get(), type); + std::unique_ptr expected = r.read(wktExpected); + ensure_equals_geometry(edgeLines.get(), expected.get()); + } +}; + + +typedef test_group group; +typedef group::object object; + +group test_coverageedges_data("geos::coverage::CoverageEdges"); + + +// testTwoAdjacentAll +template<> +template<> +void object::test<1> () +{ + checkEdges( + "GEOMETRYCOLLECTION (POLYGON ((1 1, 1 6, 6 5, 9 6, 9 1, 1 1)), POLYGON ((1 9, 6 9, 6 5, 1 6, 1 9)))", + 0, + "MULTILINESTRING ((1 6, 1 1, 9 1, 9 6, 6 5), (1 6, 1 9, 6 9, 6 5), (1 6, 6 5))" + ); +} + +// testTwoAdjacentInterior +template<> +template<> +void object::test<2> () +{ + checkEdges( + "GEOMETRYCOLLECTION (POLYGON ((1 1, 1 6, 6 5, 9 6, 9 1, 1 1)), POLYGON ((1 9, 6 9, 6 5, 1 6, 1 9)))", + 2, // INTERIOR + "MULTILINESTRING ((1 6, 6 5))" + ); +} + +// testTwoAdjacentExterior +template<> +template<> +void object::test<3> () +{ + checkEdges( + "GEOMETRYCOLLECTION (POLYGON ((1 1, 1 6, 6 5, 9 6, 9 1, 1 1)), POLYGON ((1 9, 6 9, 6 5, 1 6, 1 9)))", + 1, // EXTERIOR + "MULTILINESTRING ((1 6, 1 1, 9 1, 9 6, 6 5), (1 6, 1 9, 6 9, 6 5))" + ); +} + +// testAdjacentSquaresInterior +template<> +template<> +void object::test<4> () +{ + std::string wkt = "GEOMETRYCOLLECTION (POLYGON ((1 3, 2 3, 2 2, 1 2, 1 3)), POLYGON ((3 3, 3 2, 2 2, 2 3, 3 3)), POLYGON ((3 1, 2 1, 2 2, 3 2, 3 1)), POLYGON ((1 1, 1 2, 2 2, 2 1, 1 1)))"; + checkEdges(wkt, 2, // INTERIOR + "MULTILINESTRING ((1 2, 2 2), (2 1, 2 2), (2 2, 2 3), (2 2, 3 2))"); +} + +// testTouchingAtPointInterior +template<> +template<> +void object::test<5> () +{ + // Two polygons touching only at a point (1 1) + std::string wkt = "GEOMETRYCOLLECTION (POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)), POLYGON ((1 1, 1 2, 2 2, 2 1, 1 1)))"; + checkEdges(wkt, 2, // INTERIOR + "MULTILINESTRING EMPTY"); +} + +// testTouchingAtPointExterior +template<> +template<> +void object::test<6> () +{ + // Two polygons touching only at a point (1 1) + std::string wkt = "GEOMETRYCOLLECTION (POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0)), POLYGON ((1 1, 1 2, 2 2, 2 1, 1 1)))"; + checkEdges(wkt, 1, // EXTERIOR + "MULTILINESTRING ((0 0, 0 1, 1 1, 1 0, 0 0), (1 1, 1 2, 2 2, 2 1, 1 1))"); +} + +} // namespace tut ----------------------------------------------------------------------- Summary of changes: NEWS.md | 1 + capi/geos_c.cpp | 15 + capi/geos_c.h.in | 48 +++- capi/geos_ts_c.cpp | 53 ++++ include/geos/coverage/CoverageEdges.h | 61 ++++ include/geos/operation/spanning/SpanningTree.h | 59 ++++ src/coverage/CoverageEdges.cpp | 76 +++++ src/operation/spanning/SpanningTree.cpp | 159 +++++++++++ tests/unit/capi/GEOSCoverageEdgesTest.cpp | 51 ++++ tests/unit/capi/GEOSMinimumSpanningTreeTest.cpp | 175 ++++++++++++ tests/unit/coverage/CoverageEdgesTest.cpp | 113 ++++++++ tests/unit/operation/spanning/SpanningTreeTest.cpp | 308 +++++++++++++++++++++ 12 files changed, 1115 insertions(+), 4 deletions(-) create mode 100644 include/geos/coverage/CoverageEdges.h create mode 100644 include/geos/operation/spanning/SpanningTree.h create mode 100644 src/coverage/CoverageEdges.cpp create mode 100644 src/operation/spanning/SpanningTree.cpp create mode 100644 tests/unit/capi/GEOSCoverageEdgesTest.cpp create mode 100644 tests/unit/capi/GEOSMinimumSpanningTreeTest.cpp create mode 100644 tests/unit/coverage/CoverageEdgesTest.cpp create mode 100644 tests/unit/operation/spanning/SpanningTreeTest.cpp hooks/post-receive -- GEOS From git at osgeo.org Tue Mar 31 15:41:02 2026 From: git at osgeo.org (git at osgeo.org) Date: Tue, 31 Mar 2026 15:41:02 -0700 (PDT) Subject: [geos-commits] [SCM] GEOS branch main updated. 1a8eb16b2c90598d71fd6e469c79ec0ce6bba33e Message-ID: <20260331224102.B997D137632@trac.osgeo.org> 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 1a8eb16b2c90598d71fd6e469c79ec0ce6bba33e (commit) from be17b189a8accbf68d5f76f8b45237fd2307011c (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 1a8eb16b2c90598d71fd6e469c79ec0ce6bba33e Author: Paul Ramsey Date: Tue Mar 31 15:40:32 2026 -0700 Add NEWS entry for GEOSMinimumSpanningTree diff --git a/NEWS.md b/NEWS.md index 79fb62aa5..cb455468c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ 2026-xx-xx - New things: + - Add GEOSMinimumSpanningTree (Paul Ramsey) - Add GEOSCoverageEdges (Paul Ramsey) - Add new C API functions for Hausdorff distance (GH-1352, Sven Jensen) - Add GEOSSubdivideByGrid (GH-1232, Dan Baston) ----------------------------------------------------------------------- Summary of changes: NEWS.md | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- GEOS