rafaqz / Extents.jl

A shared Extent object for Julia spatial data, with DE-9IM spatial predicates
MIT License
4 stars 3 forks source link

StackOverflow Error for intersect of multiple extents if one intersection is empty #12

Open felixcremer opened 1 year ago

felixcremer commented 1 year ago

When I try to compute the intersect of multiple Extents and the intersect of one of the combinations is empty I get a StackOverflowError. I would have expected, that the result would be nothing because the intersection of these Extent should be empty:

julia> Extents.intersect(Extent(X=(1,2), Y=(0,1)),Extent(),Extent(X=(1,3), Y=(-0.5,0.5)))
ERROR: StackOverflowError:
Stacktrace:
 [1] intersect(obj1::Nothing, obj2::Extent{(:X, :Y), Tuple{Tuple{Int64, Int64}, Tuple{Float64, Float64}}}) (repeats 79984 times)
   @ Extents ~/.julia/packages/Extents/D8Bv0/src/Extents.jl:161

If the empty Extent is at the end of the list this works and returns nothing as expected.

rafaqz commented 1 year ago

Stackoverflow is not good...

Maybe Extent(X=nothing, Y=(1.0, 2.0)) ?

I dont know what makes the most sense