views:

1101

answers:

2

HI guys, Take a look at the map coordinates on this page. This is linked in from Wikipedia and the coordinates are passed the query string. I'm not sure of teh actual terms for this but How do I convert the coordinates as they are noted as:

37° 14′ 6″ N, 115° 48′ 40″ W

Into as so..

37.235, -115.811111

...a format which is readable by google maps as on this link

I'm using Php for this? Plus what are the two different types of coordinates called :( sorry I wasn't very good at maths in high school :(

+7  A: 

The original format is in hours, minutes, seconds format. To convert to decimal, do:

D = H + M/60 + s/3600

So in your example, 37,14,6 becomes

37 + 14/60 + 6/3600 = 37.235, as stated.

If the latitude is N the result is positive, if S, negative. If the longitude is E the result is positive. If west the result is negative.

Visage
Thanks for the formulae - just used it in my php code as is.
Ali
A: 

Umm the page you mention already gives you the coordinates in WGS84 and in Latitude Longitude format

jitter
Yeah I know that but I just want a formula to get the latitude and longitude from the coordinates - WGS84 as you said format. Or a function in Php would be even nicer :)
Ali