trevor1940
asked on
perl: Testing MGRS coordinates
Hi
I need to convert MGRS coordinates into digital Latitude Longitude
The metacpan module Geo::Coordinates::UTM achieves this by
However if the MGRS coordinates are incorrect it fails by crashing the script
How do I test the MGRS coordinates prior to conversion? without killing the script but report error to user
Tried this but still crashes
BTW I need to test all the MGRS coordinates within the In put Doc so I can report it to the user
I need to convert MGRS coordinates into digital Latitude Longitude
The metacpan module Geo::Coordinates::UTM achieves this by
($latitude,$longitude)=mgrs_to_latlon(23,'30VWK1254306804')
However if the MGRS coordinates are incorrect it fails by crashing the script
How do I test the MGRS coordinates prior to conversion? without killing the script but report error to user
Tried this but still crashes
if( ($latitude,$longitude)=mgrs_to_latlon(23,$mgrs) ){
## Do something with $mgrs
}
else{
print "$mgrs incorrect in $InputDoc\n"
}
BTW I need to test all the MGRS coordinates within the In put Doc so I can report it to the user
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER