function getlocations_dd_to_dms in Get Locations 7
Same name and namespace in other branches
- 7.2 getlocations.module \getlocations_dd_to_dms()
Convert decimal degrees to degrees,minutes,seconds. from location module
Parameters
float Decimal degrees:
Return value
array degrees,minutes,seconds,sign
2 calls to getlocations_dd_to_dms()
- theme_getlocations_latitude_dms in ./
getlocations.module - Returns HTML of a latitude in decimal degress expressed in degrees, minutes and seconds.
- theme_getlocations_longitude_dms in ./
getlocations.module - Returns HTML of a longitude in decimal degress expressed in degrees, minutes and seconds.
File
- ./
getlocations.module, line 5920 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_dd_to_dms($coord) {
$negative = $coord < 0 ? TRUE : FALSE;
$coord = abs($coord);
$degrees = floor($coord);
$coord -= $degrees;
$coord *= 60;
$minutes = floor($coord);
$coord -= $minutes;
$coord *= 60;
$seconds = round($coord, 6);
return array(
$degrees,
$minutes,
$seconds,
$negative,
);
}