-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add __geo_interface__ for items #885
Conversation
Codecov ReportBase: 94.29% // Head: 94.31% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #885 +/- ##
==========================================
+ Coverage 94.29% 94.31% +0.01%
==========================================
Files 80 80
Lines 11909 11941 +32
Branches 1130 1132 +2
==========================================
+ Hits 11230 11262 +32
Misses 496 496
Partials 183 183
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
This is a tough one, but worries me a bit. In pandas, I think we've regretted "values-dependent" behavior, where the output type or structure depends on the values of the input, rather than just the type, every single time we've done it (on purpose or accidentally). What's the downside to always returning a MultiPolygon for a Collection (even if it has just a single member)? Will they be fundamentally harder for downstream consumers to use than a single Polygon? |
I don't know -- I don't have a great sense of the downstream tooling. It felt weird to make a thing IMO bigger issue is whether we include the first bounding box (full envelope) in that MultiPolygon |
I've removed |
Related Issue(s):
__geo_interface__
#786Description:
Adds
__geo_interface__
for items, collections, and spatial extent. Includes apystac.utils.box
function that cribs from shapely, with a couple of tweaks. Collection and spatial extent geo interfaces are impelemented per @duckontheweb's suggestion (iflen(bboxes) == 1
, use that as a Polygon; iflen(bboxes) > 1
, usebboxes[1:]
as a MultiPolygon).I can see @philvarner's point that we're making an opinionated decision w.r.t. the Collection geointerface that may not be correct. It'd be good to get other's opinions on the correct Collection approach, and if there's disagreement it may make sense to remove it from this PR and put that decision off until later. I've pulled in a couple of reviewers for that reason.
PR Checklist:
pre-commit run --all-files
)scripts/test
)