I'm trying to plot out GPS data that is given to me in Hour Minute Second degree format. Will GLatLng take it in this form or do I need to convert it first. Having a hard time finding anything on the internet about this. If it can take it in this format an example would be much appreciated.
Asked
Active
Viewed 4,710 times
3
-
1See this question: http://stackoverflow.com/questions/1140189/converting-latitude-and-longitude-to-decimal-values – Chris B Nov 17 '09 at 23:44
1 Answers
8
As far as I know it does not accept that format, but its really easy to convert it, just do the math:
var = hour+(((minute*60)+(second))/3600);

Sergi
- 2,872
- 2
- 25
- 24
-
Thanks but I am having a hard time with the Latitude as this formula doesn't account for the earth not being perfectly spherical. I'm also having a hard time finding a formula that compensates for this. Precision is of the up most importance on this project. – Serhiy Nov 18 '09 at 16:16
-
@Serhiy - This formula perfectly converts a coordinate from 'Degree-Minute-Second' format to 'Decimal Degrees' format. The shape of the earth doesn't affect this conversion, though it does affect things like calculating distances – Chris B Nov 18 '09 at 17:13
-
@Chris B - I see... thanks for the explanation... I think I was having some calculation issues either with PHP or JS... they've been resolved for the most part. – Serhiy Jul 21 '10 at 14:26