xmp2gps.args Possible Bug?

Started by Mac2, May 05, 2018, 02:49:56 AM

Previous topic - Next topic

Mac2

Hi,

I'm using ExifTool for a long time in my application to manage metadata. I usually update XMP metadata and then use the xmp2* arg files provided to sync data from XMP into EXIF/GPS/IPTC. Works great.

Yesterday I ran into an issue with GPS Destination data that I don't understand.

I start with a JPEG file which has XMP-exif data with GPS information but no (EXIF) GPS data.
The relevant parts:

[XMP-exif]      GPS Altitude                    : 0
[XMP-exif]      GPS Dest Latitude               : 51.007
[XMP-exif]      GPS Dest Longitude              : -0.007
[XMP-exif]      GPS Img Direction               : 131.75135501355
[XMP-exif]      GPS Img Direction Ref           : T
[XMP-exif]      GPS Latitude                    : 51.4838750666667
[XMP-exif]      GPS Longitude                   : -0.129561416666667
[XMP-exif]      GPS Map Datum                   : WGS-84
[XMP-exif]      GPS Date/Time                   : 2012:09:01 19:21:57Z
[XMP-exif]      GPS Version ID                  : 2.2.0.0


when I now run the xmp2gps.args file, the file receives the following GPS data:

[GPS]           GPS Version ID                  : 2 2 0 0
[GPS]           GPS Latitude Ref                : N
[GPS]           GPS Latitude                    : 51.4838750666667
[GPS]           GPS Longitude Ref               : W
[GPS]           GPS Longitude                   : 0.129561416691667
[GPS]           GPS Altitude                    : 0
[GPS]           GPS Time Stamp                  : 19:21:57
[GPS]           GPS Img Direction Ref           : T
[GPS]           GPS Img Direction               : 131.751355
[GPS]           GPS Map Datum                   : WGS-84
[GPS]           GPS Dest Latitude               : 51.457706
[GPS]           GPS Dest Longitude              : 0.082525
[GPS]           GPS Date Stamp                  : 2012:09:01


The Latitude/Longitude is correctly transferred from XMP to GPS. But where do the DestLatitude/DestLongitude values come from?
They would have expected that they are 51.007 / 0.007 like in the XMP GPS record. Is this a bug or am I stupid again?

Phil Harvey

There is something odd happening for you.  I get this with the current version:

% exiftool a.jpg -xmp:gpsdestlatitude=51.007 -xmp:gpsdestlongitude=-0.007
    1 image files updated
% exiftool a.jpg -@ arg_files/xmp2gps.args
    1 image files updated
% exiftool a.jpg -G1 -"gps*"
[GPS]           GPS Version ID                  : 2.3.0.0
[GPS]           GPS Dest Latitude               : 51.007000
[GPS]           GPS Dest Longitude              : 0.007000
[XMP-exif]      GPS Dest Latitude               : 51.007000 N
[XMP-exif]      GPS Dest Longitude              : 0.007000 W


So the lat/lon copy over as they should.  What version of ExifTool are you using?

However the GPSDestLatitudeRef and GPSDestLongitudeRef aren't set as they should be.  I will fix this in ExifTool in version 10.96.

Thanks for bringing this to my attention.

- Phil

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Mac2

Hi, Phil

thank you for looking into this. I'm using version 10.95.

Maybe this is related to a specific file? I will redo my tests with some other files and report what I find.

QuoteHowever the GPSDestLatitudeRef and GPSDestLongitudeRef aren't set as they should be

Ah, this probably explains another finding: I have seen the - (minus) sign vanish from coordinates after writing them to a file (via XMP) and then running XMP2GPS.arg and GPS2XMP.arg  in the reverse operation.
If there is no ref, ExifTool has to assume N or E, thus dropping the -


Mac2

I have tried to create a file which allows you to reproduce the behavior. So far I could not. Good!
If I find another file, I'll reply to this thread. My application has to deal with files mangled by various image applications over the past 20 years. I see a lot of metadata mess each day... ::)

I can send you the problem image by email if you want. It's 4 MB and probably to large to attach here.

In my tests I see that the sign is dropped for dest* coordinates when calling XMP2GPS.

Repro:

After setting the XMP data I applied an arg file with these arguments:


-overwrite_original_in_place
-charset
FILENAME=UTF8
-m
-GPS:all=
-tagsfromfile
test.jpg
-@
v:\exiftool\arg_files\xmp2exif.args
-@
v:\exiftool\arg_files\xmp2gps.args
test.jpg


and this results in:


[XMP-exif]      GPS Dest Latitude               : 51.495359
[XMP-exif]      GPS Dest Longitude              : -0.119105
[GPS]           GPS Dest Latitude               : 51.495359
[GPS]           GPS Dest Longitude              : 0.119105


test.jog is attached.


Phil Harvey

Send me the problem file (philharvey66 at gmail.com).

Yes, the sign is dropped because the EXIF GPS reference direction tags are not written, and the EXIF GPS coordinates must be positive.  I'll fix this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Mac2


Phil Harvey

I got your test file, but I don't see any problems after running xmp2gps.args on this file:

% exiftool a.jpg -gpsdest"*" -G1 -a
[GPS]           GPS Dest Latitude               : 51.457706
[GPS]           GPS Dest Longitude              : 0.082525
[XMP-exif]      GPS Dest Latitude               : 51.007000 N
[XMP-exif]      GPS Dest Longitude              : 0.007000 W
% exiftool a.jpg -@ arg_files/xmp2gps.args
    1 image files updated
% exiftool a.jpg -gpsdest"*" -G1 -a
[GPS]           GPS Dest Latitude               : 51.007000
[GPS]           GPS Dest Longitude              : 0.007000
[XMP-exif]      GPS Dest Latitude               : 51.007000 N
[XMP-exif]      GPS Dest Longitude              : 0.007000 W


I will, however, update ExifTool and the arg_files to handle the GPS destination reference directions, so ExifTool 10.96 will give this:

% exiftool a.jpg -gpsdest"*" -G1 -a
[GPS]           GPS Dest Latitude               : 51.457706
[GPS]           GPS Dest Longitude              : 0.082525
[XMP-exif]      GPS Dest Latitude               : 51.007000 N
[XMP-exif]      GPS Dest Longitude              : 0.007000 W
[Composite]     GPS Dest Latitude Ref           : North
[Composite]     GPS Dest Longitude Ref          : West
% exiftool a.jpg -@ arg_files/xmp2gps.args
    1 image files updated
% exiftool a.jpg -gpsdest"*" -G1 -a
[GPS]           GPS Dest Latitude Ref           : North
[GPS]           GPS Dest Latitude               : 51.007000
[GPS]           GPS Dest Longitude Ref          : West
[GPS]           GPS Dest Longitude              : 0.007000
[XMP-exif]      GPS Dest Latitude               : 51.007000 N
[XMP-exif]      GPS Dest Longitude              : 0.007000 W
[Composite]     GPS Dest Latitude               : 51.007000 N
[Composite]     GPS Dest Latitude Ref           : North
[Composite]     GPS Dest Longitude              : 0.007000 W
[Composite]     GPS Dest Longitude Ref          : West


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Mac2

Then this was probably something I did wrong during my tests. I apologize for having wasted your time.

Phil Harvey

No need to apologize.  You did point out a deficiency that needed correcting. :)
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).