How to copy GPS coordinates from CSV file to XMP sidecar

Started by mf1, June 12, 2024, 10:32:50 PM

Previous topic - Next topic

mf1

Greetings,

Following step by step the instructions in this other discussion:

https://exiftool.org/forum/index.php?topic=10107.0

I created a CSV file I can pass to exiftool to directly generate .xmp sidecar files with the following fields of the XMP:dc namespace: creator, description, subject and title.

Now, I would need those files to also include the geographical coordinates of the place where a video was shot. From what I see here: https://exiftool.org/TagNames/XMP.html

There are XMP:Device tags called EarthPosLatitude and EarthPosLongitude that should do what I want. Problem is, if I add two columns with those names to the csv files, and values like e.g.  41.899238,12.476803, they are ignored. There is no error message, but those values are not added to the .xmp file.

So, is it possible to add latitude and longitude in .xmp files with Exiftool?

Thanks!

Phil Harvey

#1
I have to look into this.  ExifTool is formatting the coordinates as XMP-exif GPS coordinates, but the Format is set to "real", which is different, so a warning is generated (if you use the -v option).  I'll have to figure out which is correct, and fix this in the next release.

- Phil

Edit: ExifTool 12.87 is now available with this fix.
...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 ($).

StarGeek

Quote from: mf1 on June 12, 2024, 10:32:50 PMNow, I would need those files to also include the geographical coordinates of the place where a video was shot. From what I see here: https://exiftool.org/TagNames/XMP.html

There are XMP:Device tags called EarthPosLatitude and EarthPosLongitude that should do what I want. Problem is, if I add two columns with those names to the csv files, and values like e.g.  41.899238,12.476803, they are ignored. There is no error message, but those values are not added to the .xmp file.

Is there a reason you want to use these two tags and not the more standardized XMP-exif:GPSLatitude/XMP-exif:GPSLongitude tags? Those two tags are related to Google's Dynamic Depth/Augmented reality tags.  The specs (PDF link) say this
QuoteThe EarthPose element describes a pose (i.e., position and orientation ) with respect to the Earth coordinate system. In Dynamic Depth, this is used for describing the pose of the Realm with respect to the Earth in Device:RealmPose
and then references Wikipedia's Pose (computer vision) page.

If all you are looking for are tags to record the GPS coordinates of where the video was shot, these aren't the tags you should be using.
* 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).

mf1

Quote from: StarGeek on June 13, 2024, 11:12:23 AMIf all you are looking for are tags to record the GPS coordinates of where the video was shot, these aren't the tags you should be using.

This is indeed all I need, and yes, using THOSE tag names exiftool does add them to the XMP file. Thank @StarGeek, and thanks a lot to Phil too for fixing so quickly the general problem.

Just one note: the coordinate are reformatted/translated, i.e.  XMP-exif:GPSLatitude  41.899238 becomes exif:GPSLatitude>41,53.95428N in the XMP file. I assume it's just a translation to a different scale, but does anybody know which one, and why?



wywh

Quote from: mf1 on June 14, 2024, 03:46:56 AMthe coordinate are reformatted/translated, i.e.  XMP-exif:GPSLatitude  41.899238 becomes exif:GPSLatitude>41,53.95428N in the XMP file. I assume it's just a translation to a different scale, but does anybody know which one, and why?

Exif 2.32 for XMP specification is:

"A.2.4.4 GPSCoodinate
Value type of GPSCoodinate is a Text value in the form "DDD,MM,SSk" or "DDD,MM.mmk", where:
  - DDD is a number of degrees
  - MM is a number of minutes
  - SS is a number of seconds
  - mm is a fraction of minutes
  - k is a single character N, S, E, or W indicating a direction (north, south, east, west)

Leading zeros are not necessary for the for DDD, MM, and SS values. The DDD,MM.mmk form should be used when any of the native Exif component rational values has a denominator other than 1. There can be any number of fractional digits."

For example .xmp should be:

<exif:GPSLatitude>36,36.606S</exif:GPSLatitude>
<exif:GPSLongitude>66,54.909W</exif:GPSLongitude>

- Matti

StarGeek

Quote from: mf1 on June 14, 2024, 03:46:56 AMJust one note: the coordinate are reformatted/translated, i.e.  XMP-exif:GPSLatitude  41.899238 becomes exif:GPSLatitude>41,53.95428N in the XMP file. I assume it's just a translation to a different scale, but does anybody know which one, and why?

The GPS tags in EXIF are also different. Those need to be set as three rational numbers, i.e. as three fractions. If you use the -v (-verbose) option, exiftool you will show you the fractions that get saved.  For example
  | | 0)  GPSVersionID = 2 3 0 0
  | | 1)  GPSLatitudeRef = N
  | | 2)  GPSLatitude = 40 41 21.12 (40/1 41/1 528/25)
  | | 3)  GPSLongitudeRef = W
  | | 4)  GPSLongitude = 74 2 40.2 (74/1 2/1 201/5)

And because some fractions don't have simple representation in decimal, 1/3 for example is .333... this can lead to minor changes in the coordinates as they are translated to and from decimal.
* 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).