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

Equations for meridian convergence and partial derivatives reviewed (corrected) #526

Closed
dtutic opened this issue Jun 20, 2017 · 1 comment

Comments

@dtutic
Copy link

dtutic commented Jun 20, 2017

I have found strange results for meridian convergence in non-conformal projections. As we know from map projection books (with Gauss-Bomford convention for convergence), meridian convergence should be calculated by formula fac->conv = - atan2(fac->der.x_p , fac->der.y_p).

Current formula used in Proj4 is fac->conv = - atan2(fac->der.y_l , fac->der.x_l), which can be useful only for conformal projections (due to Cauchy-Riemann equations), and in fact should be without minus sign, i.e. fac->conv = atan2(fac->der.y_l , fac->der.x_l). For non-conformal projections we now get angle between parallel and x-axis, instead of meridian convergence.

Minus sign currently used in formula comes from fact that fac->der.x_p and fac->der.y_l are calculated with opposite signs.

Corrected equations are:

File: pj_deriv.c

Line 14
instead of:
der->x_l = t.x; der->y_p = t.y; der->x_p = -t.x; der->y_l = -t.y;
should be:
der->x_l = t.x; der->y_p = t.y; der->x_p = t.x; der->y_l = t.y;

Line 19
instead of:
der->x_l += t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l -= t.y;
should be:
der->x_l += t.x; der->y_p -= t.y; der->x_p -= t.x; der->y_l += t.y;

Line 23
instead of:
der->x_l -= t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l += t.y;
should be:
der->x_l -= t.x; der->y_p -= t.y; der->x_p -= t.x; der->y_l -= t.y;

Line 27
instead of:
der->x_l -= t.x; der->y_p += t.y; der->x_p -= t.x; der->y_l += t.y;
should be:
der->x_l -= t.x; der->y_p += t.y; der->x_p += t.x; der->y_l -= t.y;

File: pj_factors.c

Line 72
instead of:
fac->conv = - atan2(fac->der.y_l, fac->der.x_l);
should be:
fac->conv = - atan2(fac->der.x_p, fac->der.y_p);

One can question the practical use of meridian convergence in non-conformal projections, but nevertheless, it would be nice to have it calculated correctly.

@kbevers
Copy link
Member

kbevers commented Jun 21, 2017

I am not able to comment on the details of this without researching a bit first, but at least it sounds sensible.

I have created a pull request with your changes in #527. I have reformatted the code as well. Please check that the changes are equivalent to your suggestion.

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