convert co-ordinate d-m-s to decimal degrees using awk
My input is a tab-separated text file with lat long in D-M-S. I require
output to be in decimal degrees I have code in php, but this is very slow
to calculate. Can this be done quicker using awk?
node name id latitude longitude seq
nodex name1 70 N53-24-31.126 W6-20-46.982 59126
nodex name2 173 N53-20-28.885 W6-14-52.400 16190X
nodex name3 173 N53-20-28.885 W6-14-52.400 16191T
Formula:
if ($dirLat == 'N') {$signLat = '+';} Else {$signLat = '-';}
if ($dirLat == 'E') {$signLon = '+';} Else {$signLon = '-';}
$latitudeDecimalDeg = $signLat . ($degLat + ($minLat/60) + ($secLat/3600));
$longitudeDecimalDeg = $signLon . ($degLon + ($minLon/60) + ($secLon/3600));
No comments:
Post a Comment