GeographicLib::TransverseMercator and GeographicLib::TransverseMercatorExact provide accurate implelmentations of the transverse Mercator projection. The TransverseMercatorTest utility provides an interface to these classes.
References
The algorithm for GeographicLib::TransverseMercator is based on Krüger (1912); that for GeographicLib::TransverseMercatorExact is based on Lee (1976).
A test set for the transverse Mercator projection is available at
This is about 17 MB (compressed). This test set consists of a set of geographic coordinates together with the corresponding transverse Mercator coordinates. The WGS84 ellipsoid is used, with central meridian 0o, central scale factor 0.9996 (the UTM value), false easting = false northing = 0 m.
Each line of the test set gives 6 space delimited numbers
The latitude and longitude are all multiples of 10-12 deg and should be regarded as exact, except that longitude = 82.63627282416406551 should be interpreted as exactly 90 (1 - e) degrees. These results are computed using Lee's formulas with Maxima's bfloats and fpprec set to 80 (so the errors in the data are probably 1/2 of the values quoted above). The Maxima code, tm.mac and ellint.mac, used to prepare this data set is included in the distribution. You will need to have Maxima installed to use this code. The comments at the top of tm.mac illustrate how to run it.
The contents of the file are as follows:
(a total of 287000 entries). The entries for lat < 0o and lon in [90o (1 - e), 90o] use the "extended" domain for the transverse Mercator projection explained in Sec. 5 of arXiv:1002.1417. The first 258000 entries have lat >= 0o and are suitable for testing implementations following the standard convention.
Krüger (1912) gives a 4th-order approximation to the transverse Mercator projection. This is accurate to about 200 nm within the UTM domain. Here we present the series extended to 10th order. By default, GeographicLib::TransverseMercator uses the 6th-order approximation. The preprocessor variable TM_TX_MAXPOW can be used to select an order from 4 thru 8. The series expanded to order n30 are given in tmseries30.html.
In the formulas below ^ indicates exponentiation (n^3 = n*n*n) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order in n. Some of the integers here are not representable as 32-bit integers and will need to be included as double literals.
A in Krüger, p. 12, eq. (5)
A = a/(n + 1) * (1 + 1/4 * n^2 + 1/64 * n^4 + 1/256 * n^6 + 25/16384 * n^8 + 49/65536 * n^10);
gamma in Krüger, p. 21, eq. (41)
alpha[1] = 1/2 * n - 2/3 * n^2 + 5/16 * n^3 + 41/180 * n^4 - 127/288 * n^5 + 7891/37800 * n^6 + 72161/387072 * n^7 - 18975107/50803200 * n^8 + 60193001/290304000 * n^9 + 134592031/1026432000 * n^10; alpha[2] = 13/48 * n^2 - 3/5 * n^3 + 557/1440 * n^4 + 281/630 * n^5 - 1983433/1935360 * n^6 + 13769/28800 * n^7 + 148003883/174182400 * n^8 - 705286231/465696000 * n^9 + 1703267974087/3218890752000 * n^10; alpha[3] = 61/240 * n^3 - 103/140 * n^4 + 15061/26880 * n^5 + 167603/181440 * n^6 - 67102379/29030400 * n^7 + 79682431/79833600 * n^8 + 6304945039/2128896000 * n^9 - 6601904925257/1307674368000 * n^10; alpha[4] = 49561/161280 * n^4 - 179/168 * n^5 + 6601661/7257600 * n^6 + 97445/49896 * n^7 - 40176129013/7664025600 * n^8 + 138471097/66528000 * n^9 + 48087451385201/5230697472000 * n^10; alpha[5] = 34729/80640 * n^5 - 3418889/1995840 * n^6 + 14644087/9123840 * n^7 + 2605413599/622702080 * n^8 - 31015475399/2583060480 * n^9 + 5820486440369/1307674368000 * n^10; alpha[6] = 212378941/319334400 * n^6 - 30705481/10378368 * n^7 + 175214326799/58118860800 * n^8 + 870492877/96096000 * n^9 - 1328004581729009/47823519744000 * n^10; alpha[7] = 1522256789/1383782400 * n^7 - 16759934899/3113510400 * n^8 + 1315149374443/221405184000 * n^9 + 71809987837451/3629463552000 * n^10; alpha[8] = 1424729850961/743921418240 * n^8 - 256783708069/25204608000 * n^9 + 2468749292989891/203249958912000 * n^10; alpha[9] = 21091646195357/6080126976000 * n^9 - 67196182138355857/3379030566912000 * n^10; alpha[10]= 77911515623232821/12014330904576000 * n^10;
beta in Krüger, p. 18, eq. (26*)
beta[1] = 1/2 * n - 2/3 * n^2 + 37/96 * n^3 - 1/360 * n^4 - 81/512 * n^5 + 96199/604800 * n^6 - 5406467/38707200 * n^7 + 7944359/67737600 * n^8 - 7378753979/97542144000 * n^9 + 25123531261/804722688000 * n^10; beta[2] = 1/48 * n^2 + 1/15 * n^3 - 437/1440 * n^4 + 46/105 * n^5 - 1118711/3870720 * n^6 + 51841/1209600 * n^7 + 24749483/348364800 * n^8 - 115295683/1397088000 * n^9 + 5487737251099/51502252032000 * n^10; beta[3] = 17/480 * n^3 - 37/840 * n^4 - 209/4480 * n^5 + 5569/90720 * n^6 + 9261899/58060800 * n^7 - 6457463/17740800 * n^8 + 2473691167/9289728000 * n^9 - 852549456029/20922789888000 * n^10; beta[4] = 4397/161280 * n^4 - 11/504 * n^5 - 830251/7257600 * n^6 + 466511/2494800 * n^7 + 324154477/7664025600 * n^8 - 937932223/3891888000 * n^9 - 89112264211/5230697472000 * n^10; beta[5] = 4583/161280 * n^5 - 108847/3991680 * n^6 - 8005831/63866880 * n^7 + 22894433/124540416 * n^8 + 112731569449/557941063680 * n^9 - 5391039814733/10461394944000 * n^10; beta[6] = 20648693/638668800 * n^6 - 16363163/518918400 * n^7 - 2204645983/12915302400 * n^8 + 4543317553/18162144000 * n^9 + 54894890298749/167382319104000 * n^10; beta[7] = 219941297/5535129600 * n^7 - 497323811/12454041600 * n^8 - 79431132943/332107776000 * n^9 + 4346429528407/12703122432000 * n^10; beta[8] = 191773887257/3719607091200 * n^8 - 17822319343/336825216000 * n^9 - 497155444501631/1422749712384000 * n^10; beta[9] = 11025641854267/158083301376000 * n^9 - 492293158444691/6758061133824000 * n^10; beta[10]= 7028504530429621/72085985427456000 * n^10;
The high-order expansions for alpha and beta were produced by the Maxima program tmseries.mac (included in the distribution). To run, start Maxima and enter
load("tmseries.mac")$
Further instructions are included at the top of the file.