Bug in GPS when exporting RAW to JPG -- Resolved (see last post)

This old and now closed post is exactly what I’m experiencing with PhotoLab 5.2. It was probably there in previous versions, as well, since I only recently started tagging my photos with GPS data using ExifTool.

Like the older post, I am also located in Oregon, where the the longitude is -122 degrees, but after processing photos with a correct location my photo is located in China, which is longitude +122 degrees.

Below is the GPS data in the original JPG from my camera (after augmenting it with the proper GPS location) and the RAW image (also augmented with GPS location data using exiftool). Note the JPG created by PhotoLab has changed data.

======== PG9_1459_DxO.jpg
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680555556
GPS Longitude Ref               : E
GPS Longitude                   : 122.709635
GPS Latitude                    : 45.4313680555556
GPS Longitude                   : 122.709635
GPS Latitude                    : 45.4313680555556
GPS Longitude                   : 122.709635
GPS Latitude Ref                : N
GPS Longitude Ref               : E
GPS Position                    : 45.4313680555556 122.709635
======== PG9_1459.JPG
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Latitude                    : 45.4313680623167
GPS Longitude                   : -122.709634988953
GPS Position                    : 45.4313680623167 -122.709634988953
======== PG9_1459.RW2
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Latitude                    : 45.4313680623167
GPS Latitude                    : 45.4313680623167
GPS Longitude                   : -122.709634988953
GPS Longitude                   : -122.709634988953
GPS Position                    : 45.4313680623167 -122.709634988953
======== PG9_1459.RW2.dop
======== PG9_1459.xmp
GPS Latitude                    : 45.4313680555556
GPS Longitude                   : -122.709722222222
GPS Latitude Ref                : N
GPS Longitude Ref               : W
GPS Position                    : 45.4313680555556 -122.709722222222
    5 image files read

As I was writing this, I noticed that there is also something goofy with the filter, which might have something to do with this problem (probably a case of needing to be more careful with inspection of and writing EXIF data).

The goofiness with the filter is harder to reproduce. It seems like the thread that is updating the slide view while in the customize view gets stuck. Enabling and disabling viewing RGB files, for example, did nothing. Regardless, the GPS data in the files is wrong and has been changed by PhotoLab.

If I fix the GPS (from 122 E to 122 W in this case) while in the “Customize” view and then generate a new DxO JPG the result is correct.

Once the filter started working, all of the images that did not have a star rating were displaying the correct GPS location, but those with a star rating are converting 122 W into 122 E (or 122 to -122).

But wait! Changing the filter again (to display only one star images) resulted in even weirder behavior. Some were showing 122 E and some 122 W!

Ultimately, the error is in the XMP file. Here’s an example of a one star image with bad GPS data in the XMP file.

======== PG9_1454.JPG
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Latitude                    : 45.4313680623167
GPS Longitude                   : -122.709634988953
GPS Position                    : 45.4313680623167 -122.709634988953
======== PG9_1454.RW2
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Version ID                  : 2 3 0 0
GPS Latitude Ref                : N
GPS Latitude                    : 45.4313680623167
GPS Longitude Ref               : W
GPS Longitude                   : 122.709634988953
GPS Latitude                    : 45.4313680623167
GPS Latitude                    : 45.4313680623167
GPS Longitude                   : -122.709634988953
GPS Longitude                   : -122.709634988953
GPS Position                    : 45.4313680623167 -122.709634988953
======== PG9_1454.RW2.dop
======== PG9_1454.xmp
GPS Latitude                    : 45.4313680623333
GPS Longitude                   : 122.709634989
GPS Latitude Ref                : N
GPS Longitude Ref               : E
GPS Position                    : 45.4313680623333 122.709634989
    4 image files read

p.s. I am reviewing and rating my images using FastRawViewer. It also displays the GPS info and it confirms the data displayed by ExifTool, pictures taken in Oregon are marked as being in Oregon (122 W not 122 E).

Aha!! The problem is the XMP file that is being written by FastRawViewer. The JPG and RW2 files are correct. But when I star/rate an image with FastRawViewer it is incorrectly saving the GPS directional data into the XMP file it creates.

I’ll notify them of this issue.

Then it’s not a PhotoLab issue?

2 Likes

@platypus – I did some experiments based on info provided by FastRawViewer tech support and the problem does not appear to be due to FRV. FRV does not copy GPS data into the XMP file, which I confirmed.

So now it appears to be something with PhotoLab, but I need to figure out how to reliably reproduce the problem. When I took the files I was using for the FRV test and continued the process with PhotoLab I could not reproduce the issue. I suspect it has something to do with the meta-data sync feature, because I was seeing some strange behavior when I was trying to modify the filmstrip filter.

When I am able to reproduce this issue I will post here.

Mystery solved. The problem is with ExifTool.

I had written a shell script to write the GPS values that took advantage of an exiftool feature that converts a signed number into an E/W or a N/S directional reference (see note in GPS Tags page):

0x0001	GPSLatitudeRef	string[2]	
(ExifTool will also accept a number when writing GPSLatitudeRef, positive for north latitudes or negative for south, or a string containing N, North, S or South)
'N' = North
'S' = South

0x0003	GPSLongitudeRef	string[2]	
(ExifTool will also accept a number when writing this tag, positive for east longitudes or negative for west, or a string containing E, East, W or West)
'E' = East
'W' = West

Turns out, there is a problem when writing to the GPS*Ref variables described above when applied to XMP files. It works fine with JPG and RAW files, but not XMP files. It ignores the sign of the GPS numbers when applying them to an XMP file and converts the latitude and longitude values into positive GPS numbers.

I changed my script to take advantage of a relatively recent update to the GPS setting feature that allows setting the ExifTool “composite” GPSPosition variable, which does handle the signs correctly when applied to XMP files (as well as JPG and RAW image files).

For those who care, if you are using ExifTool version 12.39 or greater, this example ExifTool command-line is very convenient way to set the GPS to a bunch of image files:

exiftool '-GPSPosition=+32.266,-116.817' -i -progress *.*

NOTE: “+” is optional. Latitude is first, Longitude is second. The number format is nearly identical to what Google Maps gives you if you right-click on a map location. Just remove the space that Google Maps adds between the latitude and longitude.

p.s. If you don’t know which version of ExifTool is installed on your system, type this at the command-line:

exiftool -ver

p.p.s. This also explains why I was seeing correct values with some images but not with all. PhotoLab is giving priority to the GPS value inside of XMP files. Since the only images that had XMP files were those that I had marked with a rating using FastRawViewer, the correct GPS value was being read from non-starred images and an incorrect value was being read from starred images.

It should be pointed out that this is not a problem with exiftool, it’s a misunderstanding of the Exif 2.31 metadata for XMP specs (see page 23). In XMP, there is not a separate reference direction tag. The reference direction is merged with the coordinates tag.

Hey @StarGeek. Great to see you here as well as the ExifTool forums :smiling_face_with_three_hearts: