Use the following to analyze your input.
function ParseDMS(input) { var parts = input.split(/[^\d\w]+/); var lat = ConvertDMSToDD(parts[0], parts[1], parts[2], parts[3]); var lng = ConvertDMSToDD(parts[4], parts[5], parts[6], parts[7]); }
The following will convert your DMS to DD
function ConvertDMSToDD(degrees, minutes, seconds, direction) { var dd = degrees + minutes/60 + seconds/(60*60); if (direction == "S" || direction == "W") { dd = dd * -1; }
Thus, your input will result in the following:
36°57'9" N = 36.9525000 110°4'21" W = -110.0725000
Decimal coordinates can be sent to Google maps for points through GLatLng(lat, lng) ( Google Maps API )
Gavin Miller Jul 16 '09 at 21:12 2009-07-16 21:12
source share