-
Notifications
You must be signed in to change notification settings - Fork 743
[GH-2527] Implement concave_hull #2529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||||||||
|
Comment on lines
+730
to
+733
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should test multiple ratio values here, not just the default of 0.0. We could do something like: Do one third of the iterations w/ 0.0, then the next third w/ 0.5, and the last third w/ 1.0. (Note the range of valid values for this argument is [0, 1]. Then also test allow_holes below (as you already are doing). |
||||||||||||
|
|
||||||||||||
| # 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) | ||||||||||||
|
Comment on lines
+749
to
+753
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think this test is necessary. We're already testing all of those cases separately in the |
||||||||||||
|
|
||||||||||||
| def test_convex_hull(self): | ||||||||||||
| for geom in self.geoms: | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a test for allow_holes=True in this file too. But we should first get to the bottom of the errors.