function getGps($exifCoord, $hemi) { $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0; $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0; $flip = ($hemi == 'W' or $hemi == 'S') ? -1 : 1; return $flip * ($degrees + $minutes / 60 + $seconds / 3600); }
function getGps($exifCoord) { $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0; $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0; //normalize $minutes += 60 * ($degrees - floor($degrees)); $degrees = floor($degrees); $seconds += 60 * ($minutes - floor($minutes)); $minutes = floor($minutes); //extra normalization, probably not necessary unless you get weird data if ($seconds >= 60) { $minutes += floor($seconds / 60.0); $seconds -= 60 * floor($seconds / 60.0); } if ($minutes >= 60) { $degrees += floor($minutes / 60.0); $minutes -= 60 * floor($minutes / 60.0); } //return array('degrees' => $degrees, 'minutes' => $minutes, 'seconds' => $seconds); return $degrees . "°" . $minutes . "′" . $seconds; }
function getGpstimestamp($exifCoord) { $hours = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0; $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; $seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0; return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds); }