Subject: | bug at converting from mgrs to utm |
Date: | Thu, 19 Jul 2007 22:59:59 +0200 |
To: | <bug-Geo-Coordinates-UTM [...] rt.cpan.org>, <grahamc [...] cpan.org> |
From: | "Matthias Lendholt" <matthias.lendholt [...] gmx.de> |
I'm using version 0.06 of Geo-Coordinates-UTM on a suse (sles) linux
distribution version 9 (kernel family 2.6)
if you convert from mgrs:33TTP86610346 to lat long you get lat:
~30.12403 and lon:~12.147
this is apparently wrong since (33)T is between 40°N and 48°N
the bug is here:
function sub mgrs_to_utm($)
row 337:
$tmpNorth=int(($tmpNorth-$north_pos)/20)*20;
using mgrs:33TTP86610346
the term "(($tmpNorth-$north_pos)/20)" is something about 1.9 and is
truncated to 1 (cause you are using int instead of a function to round).
the term "int(($tmpNorth-$north_pos)/20)*20" is 20 instead of 40 which
results in a wrong northing value of the calculated utm coordinate and
which is converted to a wrong lat value in lat/lon. somehow lon is also
wrong.
hope this was a useful hint to you
finally I found other values for eccentricity^2:
WGS_84: 0.006739496756587
International: 0.00676818480813868
I found them in this spreadsheet:
http://www.uwgb.edu/dutchs/UsefulData/UTMConversions1.xls
greetings,
Matthias Lendholt