-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Using bounding_rect()
on a GeometryCollectionArray
causes a stack overflow
#979
Comments
Thanks; this is a helpful bug report! Is there a traceback you can include? |
Unfortunately I couldn't coerce a backtrace from either this reproduction test, or my actual test case that started failing after updating. It seems the normal I guess I should probably be a bit more clear with the bug report. I can't guarantee that the issue only exists in |
Unless you specifically have geometry collections, you should use That said, we should fix this because it'll likely pop up in other places where we use GeometryCollections. I don't have a guess as to what's happening off the top of my head |
Thanks for the tip on using As far as this bug, I've done some digging for us and I think I've found it. In short, If you place this test in #[cfg(test)]
mod tests {
use arrow_buffer::OffsetBufferBuilder;
use crate::array::PointArray;
use super::*;
#[test]
fn stack_overflow_repro() {
let array: MixedGeometryArray =
PointArray::from((vec![geo::point!(x: 0., y: 0.)].as_slice(), Dimension::XY)).into();
let mut offsets = OffsetBufferBuilder::new(1);
offsets.push_length(1);
let offsets = offsets.finish();
let gc = GeometryCollection::new(&array, &offsets, 0);
let _: geo::Geometry = gc.into();
panic!("unreachable code")
}
} |
#984 should fix this. By the way
Since bounding rect is such a simple algorithm to implement (well, excluding the antimeridian), we have a "native" impl as well, that doesn't convert coordinates to Now that I'm looking at that code again, the naming could probably be better though. |
Thanks for the tip on the native impl, I'll move to using that instead. As far as naming goes (one of the truly hard problems in code), after looking at both the trait and the struct, I'm wondering if renaming the struct to |
I recently upgraded to the most recently published 0.4.0-beta.3 branch so I could use
geoarrow
with the updatedgeo
dependency. However, as the title states, usingbounding_rect()
on aGeometryCollectionArray
causes a stack overflow. Reproduction code below:The text was updated successfully, but these errors were encountered: