public function File::getGPSExif in Geocoder 7.2
Helper function to retrieve latitude and longitude data from exif.
Parameters
$coordinate:
$hemisphere:
Return value
float
1 call to File::getGPSExif()
- File::geocode in src/
Geocoder/ Provider/ File.php
File
- src/
Geocoder/ Provider/ File.php, line 41
Class
- File
- @author Pol Dellaiera <pol.dellaiera@gmail.com>
Namespace
Geocoder\ProviderCode
public function getGPSExif($coordinate, $hemisphere) {
for ($i = 0; $i < 3; $i++) {
$part = explode('/', $coordinate[$i]);
if (count($part) == 1) {
$coordinate[$i] = $part[0];
}
else {
if (count($part) == 2) {
$coordinate[$i] = floatval($part[0]) / floatval($part[1]);
}
else {
$coordinate[$i] = 0;
}
}
}
list($degrees, $minutes, $seconds) = $coordinate;
$sign = $hemisphere == 'W' || $hemisphere == 'S' ? -1 : 1;
$value = $sign * ($degrees + $minutes / 60 + $seconds / 3600);
return $value;
}