Content of the GPS Latitude and GPS Longitude fields in photograph EXIF data and the required formats.
There are 4 fields for each (Lat and Lon) which I retrieve as follows in a php script
// --- Get GPS degrees latitude --- //
$GPSDegreesLat = intval($ReadEXIFData["GPS"]["GPSLatitude"][0]);
// --- Get GPS minutes latitude --- //
$GPSMinutesLat = intval($ReadEXIFData["GPS"]["GPSLatitude"][1]);
// --- Get GPS seconds latitude --- //
$GPSSecondsLat = intval($ReadEXIFData["GPS"]["GPSLatitude"][2]);
// --- Get GPS Hemisphere for latitude --- //
$GPSSecondsLat2 = ($ReadEXIFData["GPS"]["GPSLatitudeRef"]);
The same info is used for Longitude (replacing relevant words).
The results return the following (using Latitude as an example)
51/1 - Degrees
29/1 - Minutes
20649/2411 - Seconds
N - Hemisphere (North or south, and East or West for Longitude)
Apparently the figures above represent an equation so the resulting co-ordinate is
N 51 Degrees 29 Minutes 8.56 Seconds
So my first consideration is how to return the result by dividing what comes before the '/' by what follows it.
My second consideration is to the convert this calculated co-ordinate from degress to decimal.
The equation for this would be
A+B+C
where
C is the seconds divided by 3600
B is the minutes divided by 60
A is the Degrees
(The same calculations apply to the Longitude)
Finally, the decimal answer has to be negative if the Hemisphere is S or W and positive if N or E.