geoarrow / geoarrow-python

Python implementation of the GeoArrow specification
http://geoarrow.org/geoarrow-python/
Apache License 2.0
66 stars 4 forks source link

from geoarrow to pyarrow without geopandas? #45

Closed deanm0000 closed 6 months ago

deanm0000 commented 6 months ago

Is this the best way to get a pyarrow table from a GeoTable (without pandas, of course)?

pa.RecordBatchReader._import_from_c_capsule(counties.__arrow_c_stream__()).read_all()

where counties is my GeoTable.

and then as a related question, do you know if that copies since it's reading it in batches?

paleolimbot commented 6 months ago

Have you tried pyarrow.table(counties)? I think the the about-to-be-released pyarrow there is also RecordBatchReader.from_stream().

To keep the GeoArrow extension types, I think you will still have to import geoarrow.pyarrow before calling pyarrow.table().

kylebarron commented 6 months ago

To keep the GeoArrow extension types, I think you will still have to import geoarrow.pyarrow before calling pyarrow.table().

It's not strictly required when calling pyarrow.table... but the extension metadata will be on the field, and the array will not be an extension type.

deanm0000 commented 6 months ago

ugh...I did not know pa.table was a thing (only pa.Table). Yes that worked.