EXIF tags · Reference

GPSLatitude: EXIF coordinates and decimal conversion

GPSLatitude stores the magnitude of latitude as degrees, minutes, and seconds. GPSLatitudeRef supplies north or south. Without the reference, a positive-looking value does not tell you which hemisphere the camera recorded.

By ExifGrabber · Sources reviewed · Editorial standards

Tag definition

In binary EXIF, GPSLatitude is tag 0x0002 in the GPS IFD, containing three unsigned rationals. GPSLatitudeRef is tag 0x0001, an ASCII field holding N or S. Longitude uses its own value and reference fields.

Sources: ExifTool GPS tag definitions

Worked example: rationals to decimal degrees

Suppose the stored components are 33/1, 51/1, and 36/1, with a reference of S. First divide each numerator by its denominator. Then calculate 33 + 51/60 + 36/3600 = 33.86. Apply the southern sign to obtain −33.86.

The sign belongs to the complete coordinate. Negating only the degrees component would give a different and incorrect position.

decimal = degrees + minutes / 60 + seconds / 3600
latitude = hemisphere === "S" ? -decimal : decimal

Read the value and its reference

Keep reference fields alongside numeric output. The numeric representation produced by a parser is not necessarily the original rational triplet. Check its documented conversion behavior before applying a second hemisphere conversion.

exiftool -G1 -a -s -n -GPSLatitude -GPSLatitudeRef -GPSLongitude -GPSLongitudeRef photo.jpg

Sources: ExifTool value conversion

Why coordinates are missing or wrong

Reject zero denominators and out-of-range values. Latitude must be within −90 to +90 degrees. A latitude of zero is valid at the equator; do not use a truthiness check to decide whether it exists.

Many decimal places describe numeric precision, not the accuracy of the GPS fix. A plausible location can still come from an old fix or an edit. If the image was downloaded from a platform, inspect the original before concluding that the camera did not record GPS.

Related references and tools

To cite this reference, link to this page or a section heading and include the source-review date. Examples are illustrative; they are not measurements from a camera or a live platform test. Send a correction with the affected section and supporting evidence.