# [Proj] Transverse Mercator algorithm

Gerald I. Evenden geraldi.evenden at gmail.com
Tue Sep 2 20:04:16 EDT 2008

```On Tuesday 02 September 2008 5:46:31 pm Charles Karney wrote:
> Frank:
>
> I noticed an E-mail (dated 2008-05-27) from you to the proj mailing list
> concerning the availability of an accurate Transverse Mercator
> algorithm.  If you're still in need of this, I have recently implemented
> and tested the version given in
>
>    http://docs.jhs-suositukset.fi/jhs-suositukset/JHS154/JHS154.pdf
>
> and I can send you a copy.  This is LGPL'ed C++ code, but you can easily
> redo the transcription from this report if you need to use another
> licence.
>
> I've replaced with formulas in this paper for meridian convergence and
> scale with more accurate ones.
>
> The forward and reverse transforms give ~1um accuracy over quite a
> large area.  The accuracy here is defined as the maximum of
>
>    forward transform compared with the exact result
>    discrepancy when applying forward transform followed by reverse
>
> The following table summarizes the accuracy (for WGS84)
>
>    dx = max(forward error, forwards/reverse error)
>    dgam = max discrepancy in meridian convergence
>    dk = max relative error in scale
>
>    set             dx      dgam   dk
>    x<50e5          74um    0.02"  0.02%%
>    x<20e5, y<99e5  1.1um   1e-4"  3e-4%%
>    x<5e5, y<96e5   0.22um  9e-8"  1e-6%%
>    x<4e5, y<95e5   0.21um  3e-8"  4e-7%%
>
> (x,y = easting,northing with no offsets).
>
> In addition, I've computed additional terms in the series for the
> transformations so that even more accurate transforms can be computed
> (e.g., using long double).
>
> Finally, the "exact" results I benchmarked these against are obtained
> from a macsyma implementation using elliptic integrals and arbitrary
> precision arithmetic (usually I use 100 digits).  I was originally
> planning to code this implementation up into C++, but there are a few
> loose ends in this code and stop it from being industrial strength.
> (These are: checking for the correct branch cut being used in inverse
> trig functions; picking safe starting values for Newton's method for the
> inverse of some functions; and, related, ensuring that the correct root
> is returned.)  I'm happy to send you this code too.  In case you're
> unfamiliar with macsyma, it's an old computer algebra system written at
> MIT.  It can be installed on many Linux distributions with "yum install
> maxima".

At the moment I have three TMs which produce equivalent accuracy except in
the "problem area" where longitude approaches 90 degrees from the central
meridian on the equator.  If you procedures produce finite values at
lat=0,lon=90 I would very much like to see your efforts, especially in terms
of math development.

You mention elliptic integrals but I did not see them in the pdf or at least
did not recognize them.  Is  the math complete in the pdf? It seems like it
is not. Of course the language is a barrier for me but the math is easily
understandable.

A very quick scan of the pdf file makes me think the math is similar to what I
call the Swedish version and I believe they made comment about their version
being used in Finland (someone did ;-) ).  But their method fails at 0,90.

--
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
```