Metadata Editor

EXIF EditorEXIF ReaderRemove MetadataGuidesGlossaryAbout

GPSLatitude and GPSLongitude: how photo coordinates are stored

At a glance

ExifTool tag namesEXIF:GPSLatitude, EXIF:GPSLatitudeRef, EXIF:GPSLongitude, EXIF:GPSLongitudeRef, XMP:GPSLatitude, XMP:GPSLongitude
Tag ID / location0x0002 (GPSLatitude), 0x0001 (GPSLatitudeRef), 0x0004 (GPSLongitude), 0x0003 (GPSLongitudeRef)
CategoryGPS
Example value48.858222 N, 2.294500 E
On metadata-editor.comShown in the EXIF reader, editable in the EXIF editor (JPEG, TIFF)

The position where a photo was taken is held in four tags of the EXIF GPS IFD: GPSLatitude (0x0002) with GPSLatitudeRef (0x0001), and GPSLongitude (0x0004) with GPSLongitudeRef (0x0003). The numbers are unsigned. The hemisphere lives only in the Ref tags, as one letter: N or S, E or W.

Three rationals per axis

Each coordinate is three unsigned rationals (two 32-bit integers each): degrees, minutes, seconds. Verbose mode shows the raw values for the Eiffel Tower:

GPSLatitude = 48 51 29.5992 (48/1 51/1 36999/1250)

Decimal degrees are degrees + minutes/60 + seconds/3600, here 48 + 51/60 + 29.5992/3600 = 48.858222. Negate for S or W. The spec also allows decimal minutes in the second rational with seconds left at 0; the formula still works.

ExifTool prints degrees, minutes and seconds by default and decimals with -n. A western longitude shows the sign trap:

[GPS]           GPSLongitude                    : 73.985664
[GPS]           GPSLongitudeRef                 : W
[Composite]     GPSLongitude                    : -73.985664

A script that reads the GPS tag and ignores its Ref moves Manhattan to Central Asia. Use the composite value, or apply the Ref yourself.

The XMP copy

XMP keeps the same position as one string in the exif namespace, degrees plus decimal minutes with the letter appended. Adobe software uses it, notably in sidecar files:

<exif:GPSLatitude>48,51.49332N</exif:GPSLatitude>

That copy is easy to miss. exiftool -gps:all= photo.jpg deletes the EXIF GPS IFD and leaves the XMP coordinates in place; exiftool -gps:all= -xmp:geotag= photo.jpg clears both.

Reading and removing them

The EXIF reader shows the EXIF GPS tags for JPEG, TIFF, PNG and WebP, and the editor can change or clear them on JPEG and TIFF. Neither looks at the XMP copy; the metadata remover deletes everything, both copies included. In a JPEG, the GPS IFD sits inside the APP1 EXIF segment next to GPSAltitude.

Five decimal places is about a meter. On a photo taken at home, that is your address. To put the numbers on a map, see how to find where a photo was taken; to get rid of them on a phone or desktop, see removing location from photos.

Related fields

GPS altitude

GPSAltitude stores altitude in meters with the sign in GPSAltitudeRef. Why phone values are often ellipsoid heights, not sea level, and how to fix them.

GPS image direction

GPSImgDirection (0x0011) is the compass bearing of the camera, GPSImgDirectionRef (0x0010) says true or magnetic north. Format, pitfalls and privacy.

GPS horizontal positioning error

GPSHPositioningError (0x001F, EXIF 2.3) gives the horizontal error of a photo's GPS position in meters. How it differs from GPSDOP and what to do with it.

GPS timestamp

GPSTimeStamp (0x0007) and GPSDateStamp (0x001D) store the UTC time of a photo's GPS fix. Encoding, ExifTool's GPSDateTime, lag, and how to edit or remove it.

Where GPS coordinates comes up

Other Metadata Tools