GIS noob.. convert Degrees Minutes Seconds to Decimal for Google Maps

Categories: Development, GIS, blog



I started doing some stuffs on google maps for a an upcoming portal and received a list of items with GPS coordinates with it. I really don’t understand much about this coordinate and just use it as it is and inserted the data removing the spaces between the numbers and use it with Google Maps. The marker went straigh out of the map, above the north pole into the unknown.

As it turns out the GPS coordinate that I used is in Degrees Minutes Seconds format. I’d have to convert it to decimal format which google uses. You can type in the google search field the DMS format and it works but the API only accepts decimal format.

To convert it use this:

DDMMSS = DD + MM/60 + SS/60/60

for example: 101 15 201.01
list ( $dd, $mm, $ss ) = split(’ ‘, $gps_lat);
$gps_lat_dec = $dd + ( $mm / 60 ) + ( $ss / 60 / 60 ); 

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.