You are here

function _gmap_gpx_latlon_pretty in GMap Addons 5

Same name and namespace in other branches
  1. 6 gmap_gpx.inc \_gmap_gpx_latlon_pretty()
  2. 7 gmap_gpx.inc \_gmap_gpx_latlon_pretty()

File

./gmap_gpx.inc, line 192

Code

function _gmap_gpx_latlon_pretty($deg, $pos, $neg, $three = false) {
  if ($deg > 0) {
    $str = $pos;
  }
  else {
    $str = $neg;
    $deg = -$deg;
  }
  $d = $deg;
  settype($d, 'integer');
  $deg -= $d;
  if ($three && $d < 100) {
    $str .= '0';
  }
  if ($d < 10) {
    $str .= '0';
  }
  $str .= $d . '°';
  $deg *= 60;
  $deg *= 1000;
  settype($deg, 'integer');
  $deg /= 1000;
  $str .= $deg . "'";
  return $str;
}