writing GPS into XMP drops sign (+/-) "ref" information under some conditions

Started by xmnboy, May 01, 2022, 06:01:26 PM

Previous topic - Next topic

xmnboy

See this PhotoLab post for a more detailed explanation > https://feedback.dxo.com/t/possible-bug-in-gps-when-exporting-raw-to-jpg/26128/7?u=xmnboy

In a nutshell, if you use the "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" and the equivalent feature for GPSLongitudeRef the sign (E/W or N/S) is properly written into JPG and RAW files, but not in XMP files.

Fortunately, there's an even simpler approach to set the GPS position in image files, which uses the "composite" GPSPosition variable, which I discovered after trying to make the above work.  :)

Thanks for such a great tool!

StarGeek

You need to look at the specs closer.  There are no separate reference direction tags in XMP for Latitude/Longitude.  They are included in the main tag.  See page 23 of the Exif 2.31 metadata for XMP specs.

Example

C:\>exiftool -P -overwrite_original -xmp:GPSLatitude=40.6892 -XMP:GPSLongitude=-74.0445 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -e -G1 -a -s -GPS* -GPS*# y:\!temp\Test4.jpg
[XMP-exif]      GPSLatitude                     : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 74 deg 2' 40.20" W
[XMP-exif]      GPSLatitude                     : 40.6892
[XMP-exif]      GPSLongitude                    : -74.0445
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

xmnboy

I did some more inspection and would like to make the following recommendations for ExifTool:


  • Generate an error message when attempting to set the -GPSLatitudeRef or -GPSLongitudeRef parameters in an XMP file (since those tags are not supported in an XMP file).


  • Provide consistent behavior between XMP files and JPG/RAW files when assigning to the -GPSLatitude and -GPSLongitude tags by honoring signed values for all files. Assigning a signed number does the "right" thing when applying to either of these tags in an XMP file, but ignores the sign when applying to these tags in a JPG/RAW image file.
Alternatively, when assigning to the -GPSL*itudeRef tags with ExifTool, issue an info message suggesting the -GPSPosition compound tag, as described on this page (which is difficult to find).

Phil Harvey

Quote from: xmnboy on May 05, 2022, 07:01:40 PM


  • Generate an error message when attempting to set the -GPSLatitudeRef or -GPSLongitudeRef parameters in an XMP file (since those tags are not supported in an XMP file).

Basically you are asking for warnings for all tags which are assigned but aren't written to a given output file -- the number of messages would be overwhelming for many common uses.  Try adding the -v2 option sometime to see how many tags are assigned in your commands.

Quote


  • Provide consistent behavior between XMP files and JPG/RAW files when assigning to the -GPSLatitude and -GPSLongitude tags by honoring signed values for all files. Assigning a signed number does the "right" thing when applying to either of these tags in an XMP file, but ignores the sign when applying to these tags in a JPG/RAW image file.

The XMP and EXIF GPS tags are not consistent, but this is not my doing.  Blame the idiots at CIPA for these headaches.  EXIF specified unsigned coordinates, while they are signed in XMP.

- 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 ($).