Skip to content
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

reproject is not conceptually correct on Center loci #829

Open
rafaqz opened this issue Dec 5, 2024 · 6 comments
Open

reproject is not conceptually correct on Center loci #829

rafaqz opened this issue Dec 5, 2024 · 6 comments

Comments

@rafaqz
Copy link
Owner

rafaqz commented Dec 5, 2024

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.

@asinghvi17
Copy link
Collaborator

asinghvi17 commented Dec 5, 2024

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

@asinghvi17
Copy link
Collaborator

Just updated the example btw

@asinghvi17
Copy link
Collaborator

But we should document this!

@rafaqz
Copy link
Owner Author

rafaqz commented Dec 5, 2024

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!)

@asinghvi17
Copy link
Collaborator

asinghvi17 commented Dec 5, 2024

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.

@asinghvi17 asinghvi17 changed the title reproject has Locus issues reproject is not conceptually correct on Center loci Dec 5, 2024
@rafaqz
Copy link
Owner Author

rafaqz commented Dec 5, 2024

Yeah the center moving is the problem. I guess instead it could just never return Center intervals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants