-
Notifications
You must be signed in to change notification settings - Fork 25
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 pyarrow-based pandas ExtensionArray geometry classes: #2
Conversation
- MultiPoint2dArray - Line2dArray - MultiLine2dArray - Ring2dArray - Polygon2dArray - MultiPolygon2dArray
for shapely/geopandas conversion methods
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.
Nice!
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.
Nice! Added a bunch of comments (only a partial review, but since I might not have time to do the rest before friday, already posting them)
Thanks for taking a look @jorisvandenbossche, all of your comments make sense and I'll soon update the PR accordingly.
I was thinking it may make sense to eventually include 1D and 3D geometric objects / utilities in the library. @jbednar, what do you think about the possibility of non-2D support and of having "2d" in the current class names? |
I only currently need 2D shapes out of this library, but historically, I've always eventually regretted when I've committed an entire library to be 2D only. So I think being explicit for the portions of the library that are specifically 2D is good. |
If it's only about 2D/3D (I don't know the use cases of 1D?), it's also an option to use the pattern of WKT, which uses "POINT (1 2)" for 2D and "POINT 3D (& 2 3)" for 2D (so no indication is 2D, add 3D for 3D) |
Having "2d" be the default and explicitly calling out 3d/1d in the future would be fine with me as a plan. For 1d, I was thinking it might be useful to be able to represent and manipulate 1D points and intervals using the same approach as 2D. e.g. union, intersection, containment, and spacial join would all be meaningful, though I don't have a particular domain usecase in mind at the moment. |
I'll leave that up to you, @jonmmease; whatever seems more natural to you! |
The base class looks nice but seems like there is a bit of overlap with |
Yes, definitely open to it. I think these are the main things that we would need to be able to customize/override.
Thanks for taking the time to think about this @xhochy! |
Co-Authored-By: James A. Bednar <[email protected]>
Co-Authored-By: James A. Bednar <[email protected]>
Co-Authored-By: James A. Bednar <[email protected]>
Co-Authored-By: James A. Bednar <[email protected]>
Co-Authored-By: James A. Bednar <[email protected]>
Co-Authored-By: James A. Bednar <[email protected]>
"1d" and "3d" will be used in the future to disambiguate in the future if needed.
Going to merge now. At any point in the future, we should be able to update the base geometry classes to subclass a suitable fletcher base class without changing the API. |
Adds a collection of pandas
ExtensionArray
classes for representing homogenous arrays of geometric objects. The following extension arrays are added (shapely analog included in parentheses):MultiPoint2dArray
(shapelyMultiPoint
)Line2dArray
(shapelyLineString
)MultiLine2dArray
(shapelyMultiLineString
)Ring2dArray
(shapelyRing
)Polygon2dArray
(shapelyPolygon
)MultiPolygon2dArray
(shapelyMultiPolygon
)These classes are implemented as wrappers around pyarrow
ListArray
objects.