geoarrow / geoarrow-python

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

Request for Interleaved Coordinate Format Support in GeoArrow Specification "FixedSizeList of interleaved values (i.e., [x, y, x, y, ...])" #13

Closed Shamskn closed 11 months ago

Shamskn commented 11 months ago

Problem Statement

The GeoArrow specification currently supports coordinates encoded as a Struct array, storing the coordinate values as separate arrays (i.e., x: [x, x, ...], y: [y, y, y, ...]) and a FixedSizeList of interleaved values (i.e., [x, y, x, y, ...]). When integrating the arrow file into DeckGL, the binary format requires the interleaved coordinate format. With the current ga.as_geoarrow defaulting to Struct array encoding, there is a need to create the interleaved array from the individual x and y arrays, which introduces some overhead on the frontend.

Feature Request

Is there a way to obtain the interleaved format from the as_geoarrow function? Or a trick I am missing to do this with the current functionalities?

Thank you for all the amazing work on this project. Super cool!

paleolimbot commented 11 months ago

I will double check when I'm back to a computer with this open, but I'm almost positive you can do as_geoarrow(x, coord_type=ga.CoordType.INTERLEAVED)!

kylebarron commented 11 months ago

When integrating the arrow file into DeckGL

by the way you should try using https://github.com/geoarrow/deck.gl-layers (though it's still in development). I expect to implement automatic handling for struct arrays soon

paleolimbot commented 11 months ago

I hadn't quite gotten to rendering the documentation, but it's there now! https://geoarrow.github.io/geoarrow-python/main/pyarrow.html#geoarrow.pyarrow.as_geoarrow

Shamskn commented 11 months ago

I will double check when I'm back to a computer with this open, but I'm almost positive you can do as_geoarrow(x, coord_type=ga.CoordType.INTERLEAVED)!

Thank you! I had a suspicion I was missing a config somewhere.

by the way you should try using https://github.com/geoarrow/deck.gl-layers (though it's still in development). I expect to implement automatic handling for struct arrays soon

Brilliant, This is exactly what I needed! Thank you, Kyle. You saved me the time I would have spent implementing it.

kylebarron commented 11 months ago

Brilliant, This is exactly what I needed! Thank you, Kyle. You saved me the time I would have spent implementing it.

It's still pretty early in development, so not everything will likely work out of the box, but contributions welcome