[geos-commits] [SCM] GEOS branch main updated. 927e1df7e5f4202c64d986bb8ee858d53e5b71eb
git at osgeo.org
git at osgeo.org
Sat Mar 7 19:18:12 PST 2026
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main has been updated
via 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 <dbaston at gmail.com>
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
More information about the geos-commits
mailing list