[Proj] True North Angle

Gerald I. Evenden geraldi.evenden at gmail.com
Mon Jun 23 19:58:47 EDT 2008

```On Monday 23 June 2008 7:17 pm, support.mn at elisanet.fi wrote:
> > Hello,
> >
> > Does anyone know the formula to calculate the deviation angle between
> > true north and Universal Transverse Mercator grid north?  Thanks.
> >
> > Willy Hersman
>
> Hello,
>
> There is a way to avoid any specific calculations and make an universal
> routine to do that (if you are using proj-4 as a library). You need first
> your position on the map in lat/lon coordinates. Lets say this is P1.

A simpler alternative:

If you are using the libproj4 library there is the function:

int proj_factors(PROJ_LP lp, PROJ *P, double h, struct PROJ_FACTORS *fac)

where:
lp is the geographic coordinate that you want the factors
P is the previously initialized projection
h: if non-zero is a small difference to use to determine partial differentials
normally use 0.
fac: is a structure containing (from lib_proj.h):

struct PROJ_FACTORS {
struct PROJ_DERIVS der;
double h, k;    /* meridinal, parallel scales */
double omega, thetap;   /* angular distortion, theta prime */
double conv;    /* convergence */
double s;       /* areal scale factor */
double a, b;    /* max-min scale error */
int code;       /* info as to analytics, see following */
};

the above value "conv" is what you are interested in.

If your data is in x-y space do:
proj_factors(proj_inv(xy, P), P, 0., *facs);

--
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939)  British psychologist
```