Search code examples
javascriptgoogle-mapsgpswgs84

Converting DATUM WGS84 coordinates for google map v3 JS Latlng Object


I am trying to convert the following to work with the Google maps v3 JS api.

N37 10.320 W122 13.357

How do I convert this to work with the LatLng Object?

I was expecting it to be two decimals, either positive or negative.

Thanks!


Solution

  • I guess it's just a matter of converting degree-minutes to decimals. The coordinates above mean 37 degrees + 10.320 minutes. 60 minutes make one degree so you should be getting:

    lat = degrees + minutes/60
    

    In your example

    37.172269 = 37 + 10.320/60
    

    The N/S E/W translate to the sign of the coordinate. I guess North and East mean positive signs, South and West mean negative.