-
Notifications
You must be signed in to change notification settings - Fork 17
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
Python: Prototype top-level functions that work on external input #266
Comments
kylebarron
added a commit
that referenced
this issue
Dec 4, 2023
This is just a proof of concept, only for area. It's annoying how verbose the implementation is, so I want to ideate on that a bit more. It works! ```py import pyarrow as pa import shapely import pandas as pd import geopandas as gpd from geoarrow.rust.core import WKBArray gdf = gpd.read_file(gpd.datasets.get_path('nybb')) large_gdf = pd.concat([gdf] * 1000) wkb = shapely.to_wkb(large_gdf['geometry']) pa_wkb_arr = pa.array(wkb) rust_wkb_arr = WKBArray.from_arrow(pa_wkb_arr) rust_multi_polygon_arr = rust_wkb_arr.to_multi_polygon_array() area1 = rust_multi_polygon_arr.area() from geoarrow.rust.core import area area2 = area(rust_multi_polygon_arr) ``` <img width="350" alt="image" src="https://github.com/geoarrow/geoarrow-rs/assets/15164633/e0ba4dc2-b441-4f7a-a4f3-b10dea43f1a6"> Closes #266. For geoarrow/geoarrow-python#38
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So each function will do:
__arrow_c_array__
dunderThis may make sense to do after #236 is done, because then you can just use
dyn GeometryArray
here, though I guess refactoring after that would be a pretty small change.For geoarrow/geoarrow-python#38
The text was updated successfully, but these errors were encountered: