Rasters.jl
Rasters.jl copied to clipboard
`reproject` is not conceptually correct on `Center` loci
It seems to give slightly different results if shiftlocus(Center, rast) is used before or after reproject. This could be intrinsically from shiftlocus being weird on an Irregular lookup. But it needs investigation.
I would expect some error, since the midpoint in the source space may not be the midpoint in the target space as well. See this example in web mercator, where the midpoint between 70 and 80 N is 75 N in lat long, but 75.84 N in web mercator. So the space matters, since it is a nonlinear scaling.
julia> using Proj
julia> trf = Proj.Transformation("EPSG:4326", "EPSG:3857"; always_xy = true)
Transformation pipeline
description: axis order change (2D) + Popular Visualisation Pseudo-Mercator
definition: proj=pipeline step proj=unitconvert xy_in=deg xy_out=rad step proj=webmerc lat_0=0 lon_0=0 x_0=0 y_0=0 ellps=WGS84
direction: forward
julia> p1 = trf(0, 70)
(0.0, 1.1068715659379492e7)
julia> p2 = trf(0, 80)
(0.0, 1.5538711096309224e7)
julia> inv(trf)((p1 .+ p2) ./ 2)
(0.0, 75.83979753052014)
julia> inv(trf)
Transformation pipeline
description: axis order change (2D) + Popular Visualisation Pseudo-Mercator
definition: proj=pipeline step proj=unitconvert xy_in=deg xy_out=rad step proj=webmerc lat_0=0 lon_0=0 x_0=0 y_0=0 ellps=WGS84
direction: inverse
Just updated the example btw
But we should document this!
Yeah. I guess for Intervals we should do the interval bounds properly and make them Explicit then do the center as well separately.
(and yes I'm noticing this a lot plotting norway/svalbard!)
Hmm that is only necessary if the intervals are Center I think, because of the difference in the nature of the spaces. For Start or End, since the transform is invertible we already get this for free with irregular but implicit intervals.
Yeah the center moving is the problem. I guess instead it could just never return Center intervals
This is also a nice candidate for bin edges style explicit...
Totally, still a bit weird that the centre won't be in the center