This also introduces the question: how to we deal with functions that depend on a specific version of s2geography? Short term we can just ensure we do a upstream release and require the latest version, but longer term we might need to have some mechanism for this? -> added some version definitions that can be used in C++
Some other notes:
This PR adds a from_geoarrow that accepts any Arrow-compatible array object (through the Arrow PyCapsule interface). As a result, this is not a numpy vectorized function that will take any dimension of input, it's purely a 1D -> 1D function.
At the moment this PR also only adds support for __arrow_c_array__, but probably should also support __arrow_c_stream__? (given that a lot of other libraries will often only implement that)
The current upstream implementation of the s2geography::geoarrow::Reader already supports WKT, WKB and native (nested coordinates) encoding, so those work out of the box here as well.
Right now I only accept Arrow input with an extension type and let the Reader figure out the encoding, but we could also add a argument to let the user specify "WKT"/"WKB" and then accept a plain Arrow object (without geoarrow extension type)
I did try to add a specific from_wkt that is a normal vectorized function, but the problem is that pybind11's vectorize doesn't seem to like std::string argument input for a vectorized arg. -> this is done in https://github.com/benbovy/spherely/pull/50
~This depends on https://github.com/paleolimbot/s2geography/pull/23~
This also introduces the question: how to we deal with functions that depend on a specific version of s2geography? Short term we can just ensure we do a upstream release and require the latest version, but longer term we might need to have some mechanism for this? -> added some version definitions that can be used in C++
Some other notes:
from_geoarrow
that accepts any Arrow-compatible array object (through the Arrow PyCapsule interface). As a result, this is not a numpy vectorized function that will take any dimension of input, it's purely a 1D -> 1D function.__arrow_c_array__
, but probably should also support__arrow_c_stream__
? (given that a lot of other libraries will often only implement that)s2geography::geoarrow::Reader
already supports WKT, WKB and native (nested coordinates) encoding, so those work out of the box here as well.Right now I only accept Arrow input with an extension type and let the Reader figure out the encoding, but we could also add a argument to let the user specify "WKT"/"WKB" and then accept a plain Arrow object (without geoarrow extension type)
from_wkt
that is a normal vectorized function, but the problem is that pybind11'svectorize
doesn't seem to likestd::string
argument input for a vectorized arg. -> this is done in https://github.com/benbovy/spherely/pull/50