petern48 commented on code in PR #2488:
URL: https://github.com/apache/sedona/pull/2488#discussion_r2513042168
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1285,43 +1285,31 @@ def test_representative_point(self):
def test_minimum_bounding_circle(self):
s = GeoSeries(
[
- Polygon([(0, 0), (2, 0), (2, 2), (0, 2)]),
- LineString([(0, 0), (3, 0)]),
- Point(1, 1),
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ LineString([(0, 0), (2, 0)]),
+ Point(0, 0),
None,
]
)
- result = s.minimum_bounding_circle
-
- self.check_pd_series_equal(
- result.isna(), pd.Series([False, False, False, True])
- )
-
- gpd_res = result.to_geopandas()
- gpd_src = s.to_geopandas()
-
- non_null = gpd_res.notna()
-
- got_types = gpd_res[non_null].geom_type.reset_index(drop=True)
- exp_types = pd.Series(["Polygon", "Polygon", "Point"])
- pd.testing.assert_series_equal(
- got_types, exp_types, check_names=False, check_dtype=False
- )
+ expected = gpd.GeoSeries(
+ [
+ Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]),
+ LineString([(0, 0), (2, 0)]),
+ Point(0, 0),
+ None,
+ ]
+ ).minimum_bounding_circle()
- # Coverage: allow for tiny numeric tolerance on circle approximation
- covered = (
- gpd_res[non_null]
- .buffer(1e-9)
- .covers(gpd_src[non_null])
- .reset_index(drop=True)
- )
- pd.testing.assert_series_equal(
- covered, pd.Series([True, True, True]), check_names=False
- )
+ # GeoSeries path
+ result = s.minimum_bounding_circle()
+ self.check_sgpd_equals_gpd(result, expected)
- df_result = s.to_geoframe().minimum_bounding_circle
- self.check_sgpd_equals_gpd(df_result, gpd_res)
+ tg = getattr(s, "to_geoframe")
+ gdf = tg() if callable(tg) else tg
+ mbc = getattr(gdf, "minimum_bounding_circle")
+ df_result = mbc() if callable(mbc) else mbc
+ self.check_sgpd_equals_gpd(df_result, expected)
Review Comment:
What you had before is what we're looking for. Just need to add parentheses
`()` to the end of the call to `minimum_bounding_circle`.
```
df_result = s.to_geoframe().minimum_bounding_circle()
self.check_sgpd_equals_gpd(df_result, gpd_res)
```
--
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]