[OSM-talk] Question about gps coordinates 001W0547 convert to -1.0547

Frederik Ramm frederik at remote.org
Fri Jul 31 13:01:48 BST 2009


Hi,

Marc Coevoet wrote:
> Nice, I was thinking about looking for my shell prog book, and trying 
> awk & some manips on the degrees and minutes, as there is no number > 59 

In that case I'd use a famous write-only language and do something like

% perl -ne '/(\d\d\d)(E|W)(\d\d)(\d\d),(\d\d)(N|S)(\d\d)(\d\d)/; printf 
"%07.5f,%07.5f\n", ($1 + $3/60 + $4/3600)*($2 eq "E"?1:-1), ($5 + $7/60 
+ $8/3600)*($6 eq "N"?1:-1);' < input.txt > output.txt

Bye
Frederik





More information about the talk mailing list