# [Proj] Transverse Mercator algorithm

Gerald I. Evenden geraldi.evenden at gmail.com
Sun Sep 7 12:02:39 EDT 2008

```On Saturday 06 September 2008 10:03:34 pm Charles Karney wrote:
> Gerald I. Evenden wrote:
>  > A couple of notes:
>  >
>  > 1. Of the etmerc, ktmerc and ftmerc extended range versions of TM,
>  > etmerc appears to be the winner in precision as one approaches 90,0.
>  > ...  Thus the combination of highest speed and best precision goes to
>  > Denmark.
>
> I tabulate here the errors in the JHS 154 algorithm for the Transverse
> Mercator projection.  In addition I give
>
>    * the errors when additional terms (up to O(e^16)) are included in the
>      series to convert from conformal latitude to rectifying latitude.
>
>    * the errors in the convergence and scale using the formulas given in
>
>      http://lists.maptools.org/pipermail/proj/2008-September/003730.html
>
> Errors are relative to an arbitrary precision formulation (see tm.mac).
>
> The errors in libproj implementation of etmerc closely matches the
> errors in 5th order method (dx5), except that there's a minimum
> discrepancy of about 2um in the result given by the forward
> transformation followed by the reverse.  I suspect that the reverse
> transformation in etmerc is badly conditioned in some way.
>
> Define mu = asin(sin(lam) * cos(phi))
>            = angular distance from meridian

I appreciate your approach to error diagnosis in the comparison of the ?tmercs
however I must take a more brute force approach and merely look at primitive
results.  This is due to the fact that I am *not* a theoretician  but merely
one looking for the bottom line.

In this case, one bottom line is the comparison of the distance between
the ?tmerc projected locations and the base point locations generated by the
maxima program.  A slice of the comparison results along the equator follow:

# base -?tmerc distance
# lon	lat	+proj=etmerc	+proj=ktmerc	+proj=ftmerc
0	0	7.08115e-10	3.23508e-35	1.00143e-09
2	0	5.23869e-10	2.03727e-10	7.1805e-10
4	0	2.32831e-10	6.40284e-10	4.76796e-09
...
58	0	0.000126874	0.00405273	0.00602846
60	0	0.0002965	0.00825579	0.0116592
62	0	0.000727843	0.0175187	0.0235812
64	0	0.00189299	0.0390021	0.0502297
66	0	0.00527164	0.0919147	0.113676
68	0	0.015932	0.231898	0.276412
70	0	0.0531755	0.635645	0.732767
72	0	0.200653	1.93067	2.15991
74	0	0.88438	6.67957	7.27613
76	0	4.776	27.4123	29.1701
78	0	34.0907	142.346	148.445
80	0	369.14	1052.78	1079.24
82	0	1e+30	15201.4	15360.3
84	0	1e+30	536070	536149
86	0	1e+30	8.00846e+06	7.96976e+06
88	0	1e+30	1.07293e+09	1.06239e+09
90	0	1e+30	1e+30	3.89025e+124
0	2	7.2291e-10	1.74623e-10	1.5403e-09
...

As we approach no-man's land etmerc does better than the other two procedures.
It is the same picture for the other latitude rows.  I will get a 3D plot
made sometime today.  Of course, the above has one critical assumption we
must not forget: the maxima procedure is correct and god-like.

Another interesting point about etmerc (Engsager and Poder) is that the
trigonometric series are in multiple angle evaluated by Clenshaw and not the

@techreport{eng:HtTM,
author = "K. Engsager, K. Poder",
title = "The Transverse Mercator Mapping with high accuracy
for the entire Globe almost",
institution = "Danish National Space Center, Geodetic Dept.,
Danish Technical University",
pages = 7,
year = "200?"
}

The title is a little optimistic.  ;-)

PS: I should probably put proj=tmerc in the list also.

After we beat the forward projection to death I'll look at the inverse and the
turn-around closure.

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