-
Notifications
You must be signed in to change notification settings - Fork 45
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
get_extent() refactoring #318
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #318 +/- ##
==========================================
+ Coverage 90.61% 91.28% +0.67%
==========================================
Files 36 36
Lines 4700 4845 +145
==========================================
+ Hits 4259 4423 +164
+ Misses 441 422 -19
|
Actually it's completed and ready for review. Talked with @timtreis and he may add some extra functionalities/convenience parameters (used in spatialdata-plot) in a follow up PR. |
…d version and ignore empty geometries in get_extent(GeoDataFrame)
for more information, see https://pre-commit.ci
…aldata into feature/get_extent
for more information, see https://pre-commit.ci
…aldata into feature/get_extent
@Sonja-Stockhaus thanks for the bugfix and the refactoring! Please let me know when you finish with the additions and the PR is ready for review. You can tag me here/write me in Zulip. |
src/spatialdata/_core/data_extent.py
Outdated
# remove potentially empty geometries | ||
e_temp = e[e["geometry"].apply(lambda geom: not geom.is_empty)] | ||
|
||
# separate points from (multi-)polygons |
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.
This is not needed because we assume that the GeoDataFrame doesn't mix Point with Polygon/MultiPolygon types. I'll removed it to simplify the code.
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.
Very similar to a bugfix @Sonja-Stockhaus implemented in scverse/spatialdata-plot#133. Don't know if I'd delete this
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.
In the PR I kept the removal of empty points, but I have removed the split of shapes and points. It can be easily restored inside the function _get_extent_of_shapes()
if you want. We don't expect to need it now, but it would be still ok to have, just to make the code more future proof.
I applied the code review from Giovanni and added a test for the xy swap bug: #335. |
As you can see, the Python 3.9 tests fail in |
Starting a PR to rework and move the
get_extent()
function from @timtreis fromspatialdata-plot
tospatialdata
. This PR is needed for some tiles generation code that @EliHei2 is working on.