chay0112 commented on code in PR #2502:
URL: https://github.com/apache/sedona/pull/2502#discussion_r2526168842
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -781,7 +781,15 @@ def test_minimum_bounding_circle(self):
self.check_sgpd_equals_gpd(sgpd_result, gpd_result, tolerance=0.5)
def test_minimum_bounding_radius(self):
- pass
+ # minimum_bounding_radius was added from geopandas 1.0.0 and later
+ if parse_version(gpd.__version__) < parse_version("1.0.0"):
+ pytest.skip(
+ "geopandas minimum_bounding_radius requires version 1.0.0 or
higher"
+ )
Review Comment:
Ah yes, I relied on Github co-pilot for this, But I'll refer to the
documentation you mentioned from next time. Thanks
##########
python/sedona/spark/geopandas/base.py:
##########
@@ -742,8 +742,39 @@ def minimum_bounding_circle(self):
"""
return _delegate_to_geometry_column("minimum_bounding_circle", self)
- # def minimum_bounding_radius(self):
- # raise NotImplementedError("This method is not implemented yet.")
+ def minimum_bounding_radius(self):
+ """
+ Returns a ``Series`` containing the radius of the minimum bounding
circle
+ of each geometry.
+
+ The minimum bounding circle is the smallest circle that completely
encloses
+ the geometry. This method returns only the radius of that circle,
expressed
+ in the units of the GeoSeries' coordinate reference system.
+
+ Returns
+ -------
+ Series
+ A Series containing the radius of the minimum bounding circle
+ for each geometry.
+
+ Examples
+ --------
+ >>> from shapely.geometry import Point, Polygon, LineString
+ >>> from sedona.spark.geopandas import GeoSeries
+ >>> s = GeoSeries(
+ ... [
+ ... Point(0, 0),
+ ... LineString([(0, 0), (1, 1)]),
+ ... Polygon([(0, 0), (3, 0), (3, 3), (0, 3)]),
+ ... ]
+ ... )
+ >>> s.minimum_bounding_radius()
+ 0 0.000000
+ 1 ...
+ 2 ...
Review Comment:
Sure, Just addressed this, copied as is from geopandas and made import
changes little bit to match with sedona.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]