Inverted sign for GPS Longitude when using XMP2GPS.arg file

Started by Mac2, June 09, 2019, 09:39:23 AM

Previous topic - Next topic

Mac2

Platform: Windows.

I use the argument files supplied with ExifTool to map between GPS => XMP on import and XMP => GPS on export.
I also use the IPTC/EXIF args files for the same mapping purposes. My software does this for years without any problems.

Last week users reported that, under some conditions, the longitude coordinat in their files switched from W (negative) to E (positive) after writing back metadata (and thus using the XMP2GPS.args file).

When I finally had a file / workflow to reproduce this I noticed the following:

The file starts with GPS data but no XMP data. When my software imports it, it produces a rich XMP record by importing EXIF and GPS using exif2xmp.args and gps2xmp.args.
This results in:

GPS Data
Longitude: 111.92412868
LongitudeRef: W
Latitude: 36.00498965
Latitude Ref: N


XMP Data
XMP::exif\GPSLongitude: -111.92412868
XMP::exif\GPSLatitude 36.00498965


which is correct.

When I now change some metadata and let my software write back via ExifTool (including running XMP2GPS.args), the file ends up with GPS LatitudeRef / LongitudeRef missing (instead of W / N as before).
Another re-import of the file (with running GPS2XMP.arg again) then swaps the -111 latitude to 111, moving the file from Arizona to China.

Since I never noticed that before, I started going back the ExifTool version history, installing all versions starting at 11.33 upwards, repeating my above test after each installation.

It works until ExifTool version 11.37, then the problem appears in every version up the most recent 11.49.

Since I did not change my code for a long time and it worked up till ExifTool 11.37 (and for many years before that) I think there has a bug been introduced in the .38 and later versions which causes this.

Let me know if you need additional information, a sample file etc.


Hayo Baan

Strange, it's working for me as far as I can tell:

$ exiftool -n -gps* test.jpg
[EXIF:GPS]      GPS Version ID                  : 2 3 0 0
[EXIF:GPS]      GPS Latitude Ref                : N
[EXIF:GPS]      GPS Latitude                    : 36.0049896500111
[EXIF:GPS]      GPS Longitude Ref               : W
[EXIF:GPS]      GPS Longitude                   : 111.924128679961
[XMP:XMP-exif]  GPS Latitude                    : 36.00498965
[XMP:XMP-exif]  GPS Longitude                   : -111.92412868
[Composite]     GPS Latitude                    : 36.0049896500111
[Composite]     GPS Longitude                   : -111.924128679961
[Composite]     GPS Position                    : 36.0049896500111 -111.924128679961

$ exiftool -@ xmp2exif.args test.jpg
    1 image files updated

$ exiftool -n -gps* test.jpg
[EXIF:GPS]      GPS Version ID                  : 2 3 0 0
[EXIF:GPS]      GPS Latitude Ref                : N
[EXIF:GPS]      GPS Latitude                    : 36.0049896500111
[EXIF:GPS]      GPS Longitude Ref               : W
[EXIF:GPS]      GPS Longitude                   : 111.924128679961
[XMP:XMP-exif]  GPS Latitude                    : 36.00498965
[XMP:XMP-exif]  GPS Longitude                   : -111.92412868
[Composite]     GPS Latitude                    : 36.0049896500111
[Composite]     GPS Longitude                   : -111.924128679961
[Composite]     GPS Position                    : 36.0049896500111 -111.924128679961


Have you checked to see what the data after your file was altered (but before applying xmp2gps.args)?

Please share an example containing 1) the original file, 2) the file after exif2xmp.args and gps2xmp.args, 3) the file after you change some metadata, and 4) the file after you let your software write back using exiftool and xmp2gps.args.
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

I can't seem to reproduce the problem here either.  Here's what I did, using version 11.49.

  • Set EXIF GPS coordinates, clear XMP coordinates
  • Run GPS2XMP.args, check results, copied correctly, clear XMP coordinates
  • Run EXIF2XMP.args, check results, copied correctly
  • Clear EXIF GPS coordinates (XMP still holds correct coordinates)
  • Run XMP2EXIF.args, check results, copied correctly, clear EXIF coordinates
  • Run XMP2GPS.args, check results, copied correctly

Do you have a step by step procedure that shows the problem?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Mac2

I have attached a small example file.

1. The ettest.jpg file is created via the included .cmd file from a source JPEG without any metadata.
2. The cmd file then sets GPS coordinates lat/lon + ref + date and time via ExifTool.

ettest.jpg in the attached ZIP file.

3. I now let my software ingest the file and produce the rich XMP record by running GPS2XMP.args.
This produces XMP GPS data from the native GPS data as outlined in my original post.

4. I now change the XMP headline tag and then trigger a write-back.
This causes the XMP GPS data to be mapped to the native GPS data in the file via XMP2GPS.args.
Now the GPSLatitudeRef and GPSAltitudeRef in the GPS record are gone.
This is the file in the wb-1 folder in the attached ZIP file.
The following re-import and re-mapping via GPS2XMP.args inverts the XMP GPS longitude from -111... to 111.

5. I change the headline again and wite-back. This now maps the inverted (wrong) longitude back into the GPS coordinates.
This is the file in the wb-2 folder in the attached ZIP file.

As I said, I use this process for many years and it worked till version 11.37.
All versions up to that do not wipe out the Lat/Lon Ref in the GPS record when writing back.


StarGeek

Here's my output trying to follow your steps.
C:\>exiftool -overwrite_original -gpslatitude=35.999486 -gpslatituderef=N -gpslongitude=-111.928071 -gpslongituderef=W -gpsaltitude=0 -gpsaltituderef="Above Sea Level" -gpsdatestamp="2019:06:09" -gpstimestamp="12:00:00" "Y:\!temp\gps\ettest.jpg"
    1 image files updated

C:\>exiftool -g1 -a -s -gpsl*# "Y:\!temp\gps\ettest.jpg"
---- GPS ----
GPSLatitudeRef                  : N
GPSLatitude                     : 35.999486
GPSLongitudeRef                 : W
GPSLongitude                    : 111.928071000089
---- Composite ----
GPSLatitude                     : 35.999486
GPSLongitude                    : -111.928071000089

C:\>exiftool -P -overwrite_original -@ GPS2XMP.args "Y:\!temp\gps\ettest.jpg"
    1 image files updated

C:\>exiftool -g1 -a -s -gpsl*# "Y:\!temp\gps\ettest.jpg"
---- GPS ----
GPSLatitudeRef                  : N
GPSLatitude                     : 35.999486
GPSLongitudeRef                 : W
GPSLongitude                    : 111.928071000089
---- XMP-exif ----
GPSLatitude                     : 35.999486
GPSLongitude                    : -111.928071000167
---- Composite ----
GPSLatitude                     : 35.999486
GPSLongitude                    : -111.928071000089

C:\>exiftool -P -overwrite_original -xmp:headline="New Headline" "Y:\!temp\gps\ettest.jpg"
    1 image files updated

C:\>exiftool -P -overwrite_original -@ XMP2GPS.args  "Y:\!temp\gps\ettest.jpg"
    1 image files updated

C:\>exiftool -g1 -a -s -gpsl*# "Y:\!temp\gps\ettest.jpg"
---- GPS ----
GPSLatitudeRef                  : N
GPSLatitude                     : 35.999486
GPSLongitudeRef                 : W
GPSLongitude                    : 111.928071000089
---- XMP-exif ----
GPSLatitude                     : 35.999486
GPSLongitude                    : -111.928071000167
---- Composite ----
GPSLatitude                     : 35.999486
GPSLongitude                    : -111.928071000089


Can you reproduce the problem step by step on the command line?

Have you made sure that your args files are up to date?  There was a change to some of them about a year ago (May 2018), though I can't see a change that would make a difference in this case.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Mac2

Hi, thanks for helping.


You must add a

-gps=

before you apply the XMP2GPS.args. This ensures that the GPS data in the file matches what's in the XMP, without stray fields remaining.
Else your arguments make only a partial update of the GPS, leaving the rest alone, which would explain why you see different results.

This is how this worked for the past several years, no changes on my side in how the args files are used or the parameters sent to ExifTool.
Works till ET 11.37, then no more (the Ref is wiped).

I always update everything, Windows executable, all args files and configuration files shipped with the ET distribution.
I don't see any diff in the XMP2GPS.args file for a long time, and not between the 11.37 and later.

Phil Harvey

Thanks for this report.

Apr. 24, 2019 - Version 11.38
- Patched Composite GPS reference direction tags to prevent them from being created if these tags already exist


Unfortunately this change had an unintended side-effect.  The difference occurs only if you are deleting the EXIF GPS in a file then copying XMP GPS to EXIF within the same file, all in a single command.  Sorry for the inconvenience.

I'll revert this change for ExifTool 11.50.

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

Mac2

Hi, Phil

thanks for checking this.

I've scanned the release notes for GPS-related changes before installing and testing all versions downwards from 11.49.
I did not make a connection between this entry and my problem.

Good to hear that this will be fixed int he 11.50.
My users will be happy!

Thanks again.


Mac2

Just saw that the .50 is out, with the bug fix.

Thank you, Phil!  :)