You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/10/07 22:11:58 UTC
(sedona) branch master updated: [GH-3438] Compare maximum inscribed circles by center and radius in the GeoPandas parity test (#3439)
This is an automated email from the ASF dual-hosted git repository.
jiayuasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 81fab0b31fd [GH-3438] Compare maximum inscribed circles by center and radius in the GeoPandas parity test (#3439)
81fab0b31fd is described below
commit 81fab0b31fd7762e38d11004eeff37f567a2194c
Author: Jia Yu <ji...@apache.org>
AuthorDate: Wed Oct 7 15:11:52 2026 -0700
[GH-3438] Compare maximum inscribed circles by center and radius in the GeoPandas parity test (#3439)
---
.../tests/geopandas/test_match_geopandas_series.py | 26 ++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/python/tests/geopandas/test_match_geopandas_series.py b/python/tests/geopandas/test_match_geopandas_series.py
index 641102c0f7b..ece028d86f2 100644
--- a/python/tests/geopandas/test_match_geopandas_series.py
+++ b/python/tests/geopandas/test_match_geopandas_series.py
@@ -1260,7 +1260,7 @@ class TestMatchGeopandasSeries(TestGeopandasBase):
gpd_result = gpd.GeoSeries(geoms).maximum_inscribed_circle(
tolerance=tolerance
)
- self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ self.check_inscribed_circles_match(sgpd_result, gpd_result, tolerance)
# GeoPandas' own compatibility test uses row-wise zero and coarse
# tolerances, including zero as the per-geometry automatic tolerance.
@@ -1271,7 +1271,29 @@ class TestMatchGeopandasSeries(TestGeopandasBase):
gpd_result = gpd.GeoSeries(geoms[:2]).maximum_inscribed_circle(
tolerance=local_tolerance
)
- self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ self.check_inscribed_circles_match(sgpd_result, gpd_result, local_tolerance)
+
+ @staticmethod
+ def check_inscribed_circles_match(actual, expected, tolerance, min_tolerance=1e-2):
+ # Compare the center and the radius of each circle rather than the exact line,
+ # as GeoPandas' own test does. The radius line may end at any of several equally
+ # near boundary points, and the circle is only as precise as the tolerance:
+ # GEOS 3.14 (shapely 2.2) computes triangles and convex quadrilaterals exactly,
+ # while JTS 1.20 searches a grid until it is within the tolerance.
+ actual = actual.to_geopandas().sort_index()
+ expected = expected.sort_index()
+ pd.testing.assert_index_equal(actual.index, expected.index)
+ tolerances = np.broadcast_to(
+ np.nan_to_num(np.asarray(tolerance, dtype=float)), len(expected)
+ )
+ for a, e, t in zip(actual, expected, tolerances):
+ if a is None or e is None:
+ assert a is None and e is None
+ continue
+ t = max(t, min_tolerance)
+ center_distance = Point(a.coords[0]).distance(Point(e.coords[0]))
+ assert center_distance <= t, f"centers differ: {a.wkt} vs {e.wkt}"
+ assert abs(a.length - e.length) <= t, f"radii differ: {a.wkt} vs {e.wkt}"
def test_minimum_bounding_radius(self):
for geom in self.geoms: