Solved
Need to convert UTM to latitude / longitude
Posted on 2004-03-30
Need to convert UTM to Lat / Long. It's close, but not right. This is needed VERY ugently.
Thanks,
Russ
'********************************************************************
a = 6378137
b = 6356752.3142
e12 = 6.69437999014138E-03
e = 8.18191908426219E-02
e1 = 1.6792203863838E-03
M = Northing / 0.9996
mu = M / (a * (1 - e12 / 4 - 3 * e ^ 4 / 64 - 5 * e ^ 6 / 256))
J1 = 3 * e1 / 2 - 27 * e1 ^ 3 / 32 '
J2 = 21 * Sqr(e1) / 16 - (55 * e1) ^ 4 / 32 '
J3 = (151 * e1) ^ 3 / 96 '
J4 = (1097 * e1) ^ 4 / 512 '
fp = mu + J1 * Sin(2 * mu) + J2 * Sin(4 * mu) + J3 * Sin(6 * mu) + J4 * Sin(8 * mu) '
C1 = e12 * Sqr(Cos(fp)) '
T1 = Sqr(Tan(fp)) '
R1 = a * (1 - Sqr(e)) / (1 - Sqr(e) * Sqr(Sin(fp))) ^ 1.5 '
N1 = a / (1 - Sqr(e) * Sqr(Sin(fp))) ^ 0.5 '
D = Easting / (N1 * 0.9996) '
Q1 = (N1 * Tan(fp)) / R1 '
Q2 = (Sqr(D) / 2) '
Q3 = (5 + 3 * T1 + 10 * C1 - 4 * Sqr(C1) - 9 * e12) * D ^ 4 / 24
Q4 = (61 + 90 * T1 + 298 * C1 + 45 * Sqr(T1) - 3 * Sqr(C1) - 252 * e12) * D ^ 6 / 720
Q5 = D
Q6 = (1 + 2 * T1 + C1) * D ^ 3 / 6
Q7 = (5 - 2 * C1 + 28 * T1 - 3 * Sqr(C1) + 8 * e12 + 24 * Sqr(T1)) * D ^ 5 / 120
Latitude = fp - Q1 * (Q2 - Q3 + Q4) '
Longitude = Central_Meridian + (Q5 - Q6 + Q7) / Cos(fp) '
Longitude = Longitude * 180 / PI
Latitude = Latitude * 180 / PI
Easting = Easting
Northing = Northing