rafaqz / Extents.jl

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

Should we add a convenience union function that accepts a vector of Extents? #22

Closed alex-s-gardner closed 9 months ago

alex-s-gardner commented 9 months ago

I find myself often wanting the extent of many extents.

maybe something like this?

ext::Vector{Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}}:

function union(ext)
  uextent = ext[1];
  for i = eachindex(ext)[2:end]
     uextent = union(uextent, ext[i])
  end
end
rafaqz commented 9 months ago

Its already just reduce(union, extents)

(I would prefer to keep things lean here and not support to much just for minor convenience)

alex-s-gardner commented 9 months ago

Ahh.. never even thought of using reduce..