evetion/GeoArrays.jl

Allow ranges in getindex

maxfreu opened this issue · 3 comments

Hi! geoarray[1,1] works and returns the contents of all bands at position 1,1. However ga[1:10,1:10] errors. Therefore I propose to introduce:

Base.getindex(ga::GeoArray, I::Vararg{<:AbstractRange, 2}) = getindex(ga.A, I..., :)

Edit: Actually I would boil down the whole rest to:

Base.getindex(ga::GeoArray, I) = getindex(ga.A, I)

Can I work on it?

Feel free to do so, I welcome PRs. Note however, that it's probably not as easy as:

Base.getindex(ga::GeoArray, I) = getindex(ga.A, I)

As this wouldn't support ga[1:10,1:10], because ga.A has three dimensions. I do think the first suggestion by @maxfreu would work.

Don't forget to add a test for it as well.