How to use geoarrow::algorithm::geo::Intersect
#598
Replies: 1 comment
-
Assuming you're on the latest You want to first construct an IndexedPolygonArray from each array with
Yes. The thought being that the user can control when they want to take a reference onto an existing geoarrow scalar (which is an index into the array and which itself implements geometry traits) and when they want to materialize a
There are also helpers for pairwise boolean operations. Look at pub fn test_intersects(
left_arr: &PolygonArray<i32>,
right_arr: &PolygonArray<i32>,
) -> std::result::Result<BooleanArray, GeoArrowError> {
left_arr.try_binary_boolean(right_arr, |left_scalar, right_scalar| {
Ok(left_scalar.to_geo().intersects(&right_scalar.to_geo()))
})
} Additionally,
Brute force intersection will also likely be somewhat slow. When the indexed intersection gets stabilized, that should hopefully be very fast. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to get a bit more familiar with the georrow-rs library. I'd like to be able to test the intersection between two geoarrow scalar geometries. I've tried to use the
geoarrow::algorithm::geo::Intersect
trait but I am unable to figure out how it works.Is the intention to cast to geo with
to_geo()
and then use geo's algorithms in these cases?For example finding the pairwise intersection between polygon arrays, this is the best i could figure out
Beta Was this translation helpful? Give feedback.
All reactions