views:

97

answers:

1

I need to do this..

<coordinates_east>6'01.4</coordinates_east>
<coordinates_north>45'05.5</coordinates_north>

I need to convert to this google friendly format in Ruby!...please note that these are not the real converted numbers just an example of the format I think I need!

<coordinates_east>45.46998</coordinates_east>
<coordinates_north>6.90764</coordinates_north>

How?

+1  A: 
  1. your input coordinates seem to be in wrong notation. it should probably be

    <coordinates_north>45°05.5'</coordinates_north>
    <coordinates_east>6°01.4'</coordinates_east>
    

    (degrees° arcminutes'), or

    <coordinates_north>45°05'5"</coordinates_north>
    <coordinates_east>6°01'4"</coordinates_east>
    

    (degrees° arcminutes' arcseconds")

  2. once you figured out the correct input notation, you can use Parsing latitude and longitude with Ruby for converting them to decimal degrees. if your input notation is degrees° arcminutes', you have to modify it slightly. also pay attention to negative coordinates.

  3. if you only want to use it with google maps, you don't actually need to convert it, because google maps understands arcminutes/-seconds notation.

ax
Option 3 is fine for me, I can see what you mean. They work fine as they are in google maps with the second of your examples - fine with that, (degrees° arcminutes' arcseconds"). Thing is I need to get the things converted into that form - I need the ° where I have ' and a ' where I have a . an they need " on the end!Can you help me with a ruby command to do that, do I need gsub/regex? I'm goint to have 2,000 of these things! :-)
Rupert