ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: mkidd on December 07, 2014, 07:17:06 PM

Title: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: mkidd on December 07, 2014, 07:17:06 PM
I can't seem to get EXIFtool to dump GPSLatitude and GPSLongitude as signed values. My reading of the documentation, specifically the "-c FMT (-coordFormat)" section, is that using the -n option will extract coordinates as signed decimal degrees. But this doesn't seem to happen:

exiftool -n -gps:GPSLatitude -gps:GPSLongitude test.jpg
GPS Latitude                    : 32.7894995499972
GPS Longitude                   : 116.163994550106

I'm sure longitude is really negative because (1) GeoSetter shows it as such, (2) Google Panoramio positions the uploaded image correctly, and (3) exiftool will cough up W if GPSLongitudeRef if requested, i.e.

exiftool -T -n -gps:GPSLatitude -gps:GPSLongitude -gps:GPSLongitudeRef test.jpg
32.7894995499972        116.163994550106        W

It also seems like I should able to get a signed output using -c "%+.6f" where the + in the format specifier is supposed to print a signed coordinate. But this does not seem to work either:

exiftool -T -c "%+.6f" -gps:GPSLatitude -gps:GPSLongitude -gps:GPSLongitudeRef test.jpg
32.789500       116.163995      West

Am I misreading the documentation?

I see the issue for version 9.77 (also 9.69).
Title: Re: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: StarGeek on December 07, 2014, 07:46:52 PM
It looks like the GPS numbers are unsigned and use the GPS(Latitude|Longitude)Ref tags to figure out the sign.  The composite tags will take care of this for you.

c:\>exiftool -G1 -a -n -GPSLongitude x:\!temp\Test.jpg
[GPS]           GPS Longitude                   : 116.072798333333
[Composite]     GPS Longitude                   : -116.072798333333
Title: Re: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: Hayo Baan on December 08, 2014, 03:23:48 AM
StarGeek is right. The numbers are to their respective reference. In theory you could even have a negative longitude on W meaning it is actually on E ;).  Use the composite tags to get what you expect.

Cheers,
Hayo
Title: Re: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: Phil Harvey on December 08, 2014, 07:08:17 AM
I don't understand the problem:

> exiftool ~/Desktop/test.jpg -gpslatitude -gpslongitude -n -G1
[Composite]     GPS Latitude                    : 32.7894995499972
[Composite]     GPS Longitude                   : -116.163994550106


These Composite tags are shown by default, and get their sign from the GPS reference direction as Hayo mentioned.

- Phil
Title: Re: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: StarGeek on December 08, 2014, 04:41:20 PM
Quote from: mkidd on December 07, 2014, 07:17:06 PM
exiftool -n -gps:GPSLatitude -gps:GPSLongitude test.jpg
GPS Latitude                    : 32.7894995499972
GPS Longitude                   : 116.163994550106

mkidd is specifying the GPS block rather than using the defaults.
Title: Re: Sign not included for GPSLatitude and GPSLongitude tags using -n option
Post by: Phil Harvey on December 09, 2014, 01:37:28 PM
Right.  That is the problem.

- Phil