-
-
Notifications
You must be signed in to change notification settings - Fork 366
Enhancement to support GeoDataFrame, Geometry coercion, and CRS (Feature/1108) #1392
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
Conversation
…hapely, wkt, wkb, and geojson dict (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Signed-off-by: Derin Walters <[email protected]>
…a GeoSeries/Geometry or GeoDataFrame (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Signed-off-by: Derin Walters <[email protected]>
…first place since we only use in Pandas/GeoPandas engine. Add more GeoPandas tests. (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
…ore committing (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Signed-off-by: Derin Walters <[email protected]>
… add test to cover (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1392 +/- ##
==========================================
+ Coverage 93.92% 93.99% +0.06%
==========================================
Files 91 91
Lines 6787 6960 +173
==========================================
+ Hits 6375 6542 +167
- Misses 412 418 +6
☔ View full report in Codecov by Sentry. |
|
Thanks @derinwalters ! One note though: we should use the parameterized dtypes syntax, either using |
…eterized Geometry, and a bunch of tests to improve coverage (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Signed-off-by: Derin Walters <[email protected]>
…wonky behavior in python 3.8 (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
Signed-off-by: Derin Walters <[email protected]>
…ove the GeoDataFrame from_records due to not understanding its purpose well (unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
…unionai-oss#1108) Signed-off-by: Derin Walters <[email protected]>
|
@cosmicBboy Are you referring to parameterized GeoSeries? If I understand correctly, I'm assuming you mean that we should avoid the direct use of the argument in an instantiated type. # Avoid this declaration
class Schema(pa.DataFrameModel):
geometry: Geometry(crs="EPSG:4326")
# These declarations are okay
class Schema(pa.DataFrameModel):
geometry: Geometry = pa.Field(dtype_kwargs={"crs": "EPSG:4326"})
class Schema(pa.DataFrameModel):
geometry: GeoSeries[Annotated[Geometry, "EPSG:4326"]]
class Schema(pa.DataFrameModel):
geometry: GeoSeries = pa.Field(dtype_kwargs={'crs': "EPSG:4326"}) |
|
@cosmicBboy I looked through the implementation again and believe this PR is okay to merge. Do you have any timeline for the next expected release? |
correct! |
|
will be cutting a release candidate for 0.18.0 at the end of this week |
|
Thanks for the contribution @derinwalters ! |
|
Thank you! |
For #1108 and related GeoPandas discussion #693
Add support for GeoDataFrame, coercion of several input formats into GeometryArray/GeoSeries (wkt, wkb, GeoJSON dict), and extend the pandas engine Geometry dtype with a crs attribute. The latter allows for validation of data between CRS and coercion of related coordinate transformation. GeoDataFrame with multiple GeoSeries columns on different CRS is supported. Designating 'geometry' and 'crs' in GeoDataFrame not implemented because I wasn't sure the best way to go about it. It's worth noting that prior behavior of Geometry/GeoSeries remains the same (i.e., no code changes needed).
I understand that CRS isn't technically part of GeometryDtype but it makes a lot of sense to me to implement in the Geometry dtype in the context of GeoPandas. I would be open to some discussion here if there is a better way.