# [Proj] Transverse Mercator algorithm

Charles Karney ckarney at sarnoff.com
Tue Sep 2 17:46:31 EDT 2008

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

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".

--
Charles Karney <ckarney at sarnoff.com>
Sarnoff Corporation, Princeton, NJ 08543-5300

URL: http://charles.karney.info
Tel: +1 609 734 2312
Fax: +1 609 734 2662
```