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

Frederik Ramm frederik at remote.org
Fri Jul 31 00:15:22 BST 2009


Hi

Marc Coevoet wrote:
> 004E4800,47N2000
> 002W2300,57N0000
> 001W0547,51N4823
> 013E2600,47N3400
> 013E2600,47N3400
> 013E2600,47N3400
> 013E2600,47N3400
> 013E2500,47N3343
> 
> to something where 001W0547  becomes -1.0547

That can actually be done with sed on the Unix command line:

% sed -e "s/\\([0-9]*\\)[WS]/-\\1./g; s/[EN]/./g; s/^0*//g; s/;0*//g; 
s/-0*/-/g" < input.txt > output.txt

But do check your input data to find out whether the stuff after the 
letter is really fractions of degrees (if you find that you never have 
the digits 6-9 following one of the letters but only 0-5 then that would 
indicate you're dealing with minutes and seconds, which would render 
above conversion invalid).

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"




More information about the talk mailing list