You are here

function location_dd_to_dms in Location 7.3

Same name and namespace in other branches
  1. 5.3 location.module \location_dd_to_dms()
  2. 6.3 location.module \location_dd_to_dms()
  3. 7.5 location.module \location_dd_to_dms()
  4. 7.4 location.module \location_dd_to_dms()

Convert decimal degrees to degrees,minutes,seconds.

2 calls to location_dd_to_dms()
theme_location_latitude_dms in ./location.module
Display a coordinate.
theme_location_longitude_dms in ./location.module
Theme callback for longtitude dms.

File

./location.module, line 1869
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

Code

function location_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,
  );
}