ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: outdoormagic on February 10, 2022, 09:37:15 AM

Title: Unifying GPS Tags
Post by: outdoormagic on February 10, 2022, 09:37:15 AM
Good morning!

I had a problem with a file and tracked it to inconsistent GPS coordinates.

exiftool -a -G "FILE.MP4" | grep GPS

This returns:

[QuickTime]     GPS Coordinates                 : 45 deg 49' 58.00" N, 72 deg 56' 56.68" W
[XMP]           GPS Latitude                    : 45 deg 49' 58.00" N
[XMP]           GPS Longitude                   : 72 deg 56' 58.00" W
[Composite]     GPS Latitude                    : 45 deg 49' 58.00" N
[Composite]     GPS Longitude                   : 72 deg 56' 56.68" W
[Composite]     GPS Latitude Ref                : North
[Composite]     GPS Longitude Ref               : West
[Composite]     GPS Position                    : 45 deg 49' 58.00" N, 72 deg 56' 56.68" W


From this post "Composite GPS tags" https://exiftool.org/forum/index.php?topic=13205.0 (https://exiftool.org/forum/index.php?topic=13205.0), Composite tags are not the problem. The issue is QuickTime vs. XMP, specifically GPSLongitude.

3 questions:

Thank you,

Paul


PS. I altered the GPS coordinates, so my apologies if any of these match someone's location.
Title: Re: Unifying GPS Tags
Post by: StarGeek on February 10, 2022, 10:20:01 AM
Quote from: outdoormagic on February 10, 2022, 09:37:15 AM
Is there a general convention or best practice as to which tag group has the "reference" GPS Coordinates?

Generally, the last tag appearing in the file is what will be displayed.  As Composite tags are always the last tags generated, they will be the values returned if a specific group is not indicated.

QuoteIs there a way in Perl to ignore Composite tags, i.e, implement the '-e' flag in the command line?

The Perl interface is not my area of expertise, but there appear to be multiple ways to exclude a group.  There is Exclude option (https://exiftool.org/ExifTool.html#Exclude).  Under the Group# option (https://exiftool.org/ExifTool.html#GroupNum), prefixing a hyphen - will exclude a group.  And a similar example is given in the SCALAR section under ImageInfo (https://exiftool.org/ExifTool.html#ImageInfo).

QuoteIs there a way to unify GPS tags across potentially multiple groups, such as exiftool '-all:gps*<xmp:gps*' file.ext (<-- this doesn't strike me as a good idea)

Part of the problem is that tags from different groups may not be writable in all files and may not exactly translate.  GPS tags which are part of the EXIF group can't be added to video files and the Quicktime:GPSCoordinates isn't available in image files.  The arg files (https://github.com/exiftool/exiftool/tree/master/arg_files) include options to convert between the EXIF GPS tags and the XMP GPS tags (gps2xmp.args and xmp2gps.args) but overall there isn't any translation to the Quicktime GPS because GPSCoordinates is the only one that is writable.  You can look at those two arg files to see how they translate between the two groups.
Title: Re: Unifying GPS Tags
Post by: Phil Harvey on February 10, 2022, 10:27:08 AM
StarGeek responded while I was typing this, but I'll post anyway:

Hi Paul,

Quote from: outdoormagic on February 10, 2022, 09:37:15 AM
1. Is there a general convention or best practice as to which tag group has the "reference" GPS Coordinates?

For MOV/MP4 videos, I would generally go with the QuickTime GPSCoordinates.  For JPG's the EXIF.  XMP tags tend to be generated based on the values of other tags or user input.

Quote2. Is there a way in Perl to ignore Composite tags, i.e, implement the '-e' flag in the command line?

See the API Composite option (https://exiftool.org/ExifTool.html#Composite).

Quote3. Is there a way to unify GPS tags across potentially multiple groups, such as exiftool '-all:gps*<xmp:gps*' file.ext (<-- this doesn't strike me as a good idea)

No, but you can make up an argfile to do what you want.  There already exists one to write XMP GPS tags based on EXIF here (https://github.com/exiftool/exiftool/blob/master/arg_files/gps2xmp.args).

- Phil

Title: Re: Unifying GPS Tags
Post by: StarGeek on February 10, 2022, 10:30:12 AM
Quote from: Phil Harvey on February 10, 2022, 10:27:08 AM
Quote2. Is there a way in Perl to ignore Composite tags, i.e, implement the '-e' flag in the command line?

See the API Composite option (https://exiftool.org/ExifTool.html#Composite).

Ah, missed that. Even simpler.  I just searched the page for "exclude" to find the options I listed.
Title: Re: Unifying GPS Tags
Post by: outdoormagic on February 10, 2022, 10:35:15 AM
Thank you Phil and StarGeek!