-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rasterize with ext and res uses wrong corners of the Extent #851
Comments
That is indeed awkward...probably a typo? |
It hits this path
Which returns |
While #852 mostly fixes this, maybe there is still room for improvement on how edges are handled.
Gives This happens in |
We need extents.jl to have closed or open intervals. We currently have to hack a tiny pad in so closed intervals of e.g. a Multipoint is not cut off in the open high edge of a raster. R does this too |
Fixed now! julia> using Rasters, Extents
julia> extr =Extent(X=(-1,1.1), Y=(0.33,2));
julia> rasr = rasterize((1,1), to=extr, res=0.1, fill=1, reducer=sum)
┌ 22×17 Raster{Union{Missing, Int64}, 2} nothing ┐
├────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────── dims ┐
↓ X Projected{Float64} -1.0:0.1:1.1 ForwardOrdered Regular Intervals{Start},
→ Y Projected{Float64} 0.33:0.1:1.93 ForwardOrdered Regular Intervals{Start}
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── metadata ┤
Metadata of Dict{Any, Any}()
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── raster ┤
extent: Extent(X = (-1.0, 1.2000000000000002), Y = (0.33, 2.03))
missingval: missing
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
↓ → 0.33 0.43 0.53 0.63 0.73 0.83 0.93 1.03 … 1.23 1.33 1.43 1.53 1.63 1.73 1.83 1.93
⋮ ⋮ ⋱ ⋮ ⋮
1.1 missing missing missing missing missing missing missing missing missing missing missing missing missing missing missing missing The open-closed interval thing is a separate issue, I think we can close this one |
When I am running rasterize with a extent as
to
and a resolution I would have expected that the X axis spans the range of the X extent and the Y axis range of extent.Y. It seems that the X-axis is constructed from the first of the entries in extent and Y from the last entries.In the example below I would have expected that X has values
-1:0.01:1
and Y0.33:0.01:2
The text was updated successfully, but these errors were encountered: