Skip Menu |

This queue is for tickets about the Geo-Coordinates-UTM CPAN distribution.

Report information
The Basics
Id: 57344
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Geo-Coordinates-UTM

People
Owner: grahamc [...] cpan.org
Requestors: peder+cpan [...] ifi.uio.no
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08
Fixed in: 0.09



Subject: Error in calculaton of UTM from short MGRS
When feeding mgrs_to_utm with a sting that has lesser than 1m resolution, like 32VPM01235678, the function fails to do the right 0-expansion and thus returns 32V 6000123 6605678 instead of the right 32V 6001230 6656780. I see there was an commentented out attempt to do it in the source, but fails when leading zeros are present, and hangs when either easting or northing is 0. Attatched patch should fix the problem.
Subject: diff-utm.pm
--- UTM.pm 2010-05-10 13:42:06.828964000 +0200 +++ /snacks/lib/perl5/5.10.0/Geo/Coordinates/UTM.pm 2010-05-10 13:43:29.543167000 +0200 @@ -346,8 +346,8 @@ $coord_len=int($coord_len/2); my $x_coord=substr($coords,0,$coord_len); my $y_coord=substr($coords,$coord_len); - #$x_coord*=10 until (length($x_coord) >= 5); - #$y_coord*=10 until (length($y_coord) >= 5); + $x_coord *= 10 ** (5 - $coord_len); + $y_coord *= 10 ** (5 - $coord_len); my $east_pos = ( $first_letter =~ /[ABCDEFGH]/) ? index('ABCDEFGH',$first_letter)
Patched and tested for release as v0.09 via CPAN Also updated documentation