jiayuasu commented on code in PR #2529:
URL: https://github.com/apache/sedona/pull/2529#discussion_r3612176295
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -722,8 +722,35 @@ def test_centroid(self):
gpd_result = gpd.GeoSeries(geom).centroid
self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ @pytest.mark.skipif(
+ parse_version(gpd.__version__) < parse_version("0.14.0"),
+ reason="geopandas concave_hull requires version 0.14.0 or higher",
+ )
def test_concave_hull(self):
- pass
+ for geom in self.geoms:
+ sgpd_result = GeoSeries(geom).concave_hull()
+ gpd_result = gpd.GeoSeries(geom).concave_hull()
+ self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+
+ # Test slightly complex geometry for different ratio and allow_holes
settings
+ geom = [
+ Polygon(
+ [(0, 0), (0, 4), (1, 4), (1, 1), (3, 1), (3, 4), (4, 4), (4,
0), (0, 0)]
+ )
+ ]
+ for ratio, allow_holes in [(0.5, True), (1.0, True)]:
+ sgpd_result = GeoSeries(geom).concave_hull(
+ ratio=ratio, allow_holes=allow_holes
+ )
+ gpd_result = gpd.GeoSeries(geom).concave_hull(
+ ratio=ratio, allow_holes=allow_holes
+ )
+ self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+
+ mixed = [self.points[1], self.linestrings[1], self.polygons[1], None]
+ sgpd_result = GeoSeries(mixed).concave_hull()
+ gpd_result = gpd.GeoSeries(mixed).concave_hull()
+ self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
Review Comment:
Removed the mixed-geometry case. The separate per-geometry fixtures remain
as the parity coverage.
##########
python/tests/geopandas/test_match_geopandas_series.py:
##########
@@ -722,8 +722,35 @@ def test_centroid(self):
gpd_result = gpd.GeoSeries(geom).centroid
self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
+ @pytest.mark.skipif(
+ parse_version(gpd.__version__) < parse_version("0.14.0"),
+ reason="geopandas concave_hull requires version 0.14.0 or higher",
+ )
def test_concave_hull(self):
- pass
+ for geom in self.geoms:
+ sgpd_result = GeoSeries(geom).concave_hull()
+ gpd_result = gpd.GeoSeries(geom).concave_hull()
+ self.check_sgpd_equals_gpd(sgpd_result, gpd_result)
Review Comment:
Updated the parity loop to split the geometry fixtures across ratios 0.0,
0.5, and 1.0 as suggested.
##########
python/tests/geopandas/test_geoseries.py:
##########
@@ -1238,7 +1238,34 @@ def test_centroid(self):
self.check_sgpd_equals_gpd(result, expected)
def test_concave_hull(self):
- pass
+ s = GeoSeries(
+ [
+ Polygon([(0, 0), (1, 1), (0, 1)]),
+ LineString([(0, 0), (1, 1), (1, 0)]),
+ MultiPoint([(0, 0), (1, 1), (0, 1), (1, 0), (0.5, 0.5)]),
+ MultiPoint([(0, 0), (1, 1)]),
+ Point(0, 0),
+ ],
+ crs=3857,
+ )
+
+ result = s.concave_hull()
Review Comment:
Added direct and parity coverage with allow_holes=True using an asymmetric
MultiPoint fixture that produces one interior ring. The earlier symmetric
fixture no longer reproduces with current JTS and GEOS stacks; tied boundary
triangles can be processed in different orders, so the replacement avoids that
ambiguity while retaining strict geometry equality.
--
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]