EXIF tags · Reference
GPSLongitude: east, west, and coordinate order
GPSLongitude records east–west position as degrees, minutes, and seconds. GPSLongitudeRef identifies E or W. When converting to signed decimal degrees, west is negative and east is positive.
By ExifGrabber · Sources reviewed · Editorial standards
Tag definition
GPSLongitude is tag 0x0004 in the GPS IFD, stored as three unsigned rationals. GPSLongitudeRef is the ASCII companion at 0x0003. The two together identify a signed longitude.
Sources: ExifTool GPS tag definitions
Worked example: a western longitude
For components 73/1, 59/1, and 8/1 with W, the magnitude is 73 + 59/60 + 8/3600 = 73.985555… degrees. The signed value is approximately −73.985556.
Keep additional precision internally and round for presentation. Rounding before conversion can move the displayed position.
exiftool -G1 -a -s -n -GPSLongitude -GPSLongitudeRef photo.jpgAvoid swapping latitude and longitude
Use explicitly named properties such as latitude and longitude inside your application. At the boundary with a map or geometry API, read that API’s required ordering. Never infer the ordering from two bare numbers.
For example, swapping latitude 40 and longitude −74 still produces two numerically valid coordinates. Range validation alone cannot catch that error. Test an integration using a known location and assert that the map marker lands there.
Boundary cases to handle
Accept zero longitude at the prime meridian. Validate the final coordinate within −180 to +180 degrees, and handle locations near the antimeridian without treating a small crossing as a trip around the world.
If the longitude exists but the reference is absent, preserve the uncertainty. Do not assume east. If another metadata group supplies a signed coordinate, retain its provenance rather than silently merging incomplete fields.
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.