GPS tags from DNG to XMP sidecars not working

Started by thany, July 02, 2020, 08:32:08 PM

Previous topic - Next topic

thany

I'm trying to copy ALL metadata information from a set of DNGs into XMP sidecars. It's working, except for GPS tags.

This is the command:
`exiftool -ext dng -xmp -b -w xmp .`

I can check that gps tags exist in DNG, and are left out in XMP. I need this because I'm migrating from DNG-with-embedded-RAW back to RAW only and I need to transplant all the metadata back into Lightroom. XMP sidecars are the only way to do that.

thany

An unfortunate workaround I found is to update the resulting XMP sidecars with `exiftool -tagsfromfile _4160400.dng _4160400.xmp` and repeat that for each and every file individually. Kind of a pain to get this goinf, to be honest.

Can't this be done in one go?

StarGeek

Quote from: thany on July 02, 2020, 08:32:08 PM
I can check that gps tags exist in DNG, and are left out in XMP.

Normally GPS tags exist in the EXIF group.  Are you sure that they're in the XMP group in your DNG.  Run this command to see the location
exiftool -G1 -a -s -gps* /path/to/file.dng

If they don't exist in the XMP group in the DNG file, then you can use the gps2xmp.args file (put it in the same directory as exiftool) to properly copy the data over.  I believe command would be like this, but test it out first:
exiftool -ext dng -tagsfromfile @ -srcfile %d%f.xmp -@ gps2xmp.args /path/to/files/
* 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).

thany

As for the first part of your reply, I did get an output sort of what I expected, in that it lists GPS tags:


[GPS]           GPSVersionID                    : 2.2.0.0
[GPS]           GPSLatitudeRef                  : North
[GPS]           GPSLatitude                     : 34 deg 48' 28.25"
[GPS]           GPSLongitudeRef                 : East
[GPS]           GPSLongitude                    : 133 deg 37' 20.08"
[Composite]     GPSLatitude                     : 34 deg 48' 28.25" N
[Composite]     GPSLongitude                    : 133 deg 37' 20.08" E
[Composite]     GPSPosition                     : 34 deg 48' 28.25" N, 133 deg 37' 20.08" E


When I execute your suggested second comand, the resulting XMP sidecar is very different from what was previously generated. Wildly different, I would say :) But unfortunately, no GPS tags... Also unfortunately, I have a hard time deciphering your command, so I don't really know where to even start fiddling with it.

StarGeek

Quote from: thany on July 03, 2020, 04:43:06 AM
As for the first part of your reply, I did get an output sort of what I expected, in that it lists GPS tags:
[GPS]           GPSVersionID                    : 2.2.0.0
[GPS]           GPSLatitudeRef                  : North
[GPS]           GPSLatitude                     : 34 deg 48' 28.25"
[GPS]           GPSLongitudeRef                 : East
[GPS]           GPSLongitude                    : 133 deg 37' 20.08"

The leading [GPS] shows that these tags are in the GPS section of the EXIF group.  Your original command only copied XMP tags, so these tags would not be copied.

Quote from: thany on July 03, 2020, 04:43:06 AM
When I execute your suggested second comand, the resulting XMP sidecar is very different from what was previously generated. Wildly different, I would say :) But unfortunately, no GPS tags...

In what way is it different?  Here's the results from my test
C:\ >exiftool -G1 -a -s -xmp:all -GPS* y:\!temp\Test4.jpg
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.01
[XMP-dc]        Description                     : Different Description
[GPS]           GPSVersionID                    : 2.3.0.0
[GPS]           GPSLatitudeRef                  : North
[GPS]           GPSLatitude                     : 40 deg 41' 21.12"
[GPS]           GPSLongitudeRef                 : West
[GPS]           GPSLongitude                    : 74 deg 2' 40.20"
[Composite]     GPSLatitude                     : 40 deg 41' 21.12" N
[Composite]     GPSLongitude                    : 74 deg 2' 40.20" W
[Composite]     GPSPosition                     : 40 deg 41' 21.12" N, 74 deg 2' 40.20" W

File has GPS coordinates, but not in the XMP group.  It has an XMP tag set.

C:\ >exiftool -G1 -a -s -xmp:all -GPS* y:\!temp\Test4.xmp
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.01
[XMP-dc]        Description                     : Previously set Description

Sidecar file has some data set, but no GPS coordinates.

C:\ >exiftool -tagsfromfile @ -srcfile %d%f.xmp -@ gps2xmp.args y:\!temp\Test4.jpg
    1 image files updated

C:\ >exiftool -G1 -a -s -xmp:all y:\!temp\Test4.xmp
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.01
[XMP-dc]        Description                     : Previously set Description
[XMP-exif]      GPSLatitude                     : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 74 deg 2' 40.20" W
[XMP-exif]      GPSVersionID                    : 2.3.0.0

Sidecar file still has the old data but now has the GPS coordinates set.
* 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).

thany

Quote from: StarGeek on July 03, 2020, 11:53:45 AM
In what way is it different?

I haven't checked what tags are in there, but the XML structure is super different. I'd rather not get very different structure, because Lightroom is quite picky. The one generated with my original command is working in Lightroom, but I fear if the XML structure becomes too different, Lightroom might miss metadata without me noticing it, even if Exiftool reports the data is there. I want to prevent that from happening. Or do you think that's being too caucious?

Quote from: StarGeek on July 03, 2020, 11:53:45 AM
C:\ >exiftool -tagsfromfile @ -srcfile %d%f.xmp -@ gps2xmp.args y:\!temp\Test4.jpg
    1 image files updated

C:\ >exiftool -G1 -a -s -xmp:all y:\!temp\Test4.xmp
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.01
[XMP-dc]        Description                     : Previously set Description
[XMP-exif]      GPSLatitude                     : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 74 deg 2' 40.20" W
[XMP-exif]      GPSVersionID                    : 2.3.0.0

Sidecar file still has the old data but now has the GPS coordinates set.
Good to hear it's working for you. It looks like GPS tags need to be sort of transformed into something XMP-compatible? Is that what's happening? Do you think there's a single command possible to transfer *all* metadata from my DNG's into XMP sidecars?

StarGeek

Quote from: thany on July 04, 2020, 08:41:42 AM
I haven't checked what tags are in there, but the XML structure is super different. I'd rather not get very different structure, because Lightroom is quite picky. The one generated with my original command is working in Lightroom, but I fear if the XML structure becomes too different, Lightroom might miss metadata without me noticing it, even if Exiftool reports the data is there. I want to prevent that from happening. Or do you think that's being too caucious?

We haven't had any reports of problems with Lightroom not reading XMP sidecards created by exiftool. Also understand, the sidecar files are XMP, which is based upon XML, but is not XML. At least that's my understanding from various posts Phil has made about XMP vs. XML (such as this one).

QuoteGood to hear it's working for you. It looks like GPS tags need to be sort of transformed into something XMP-compatible?

Which is what the gps2xmp.args file I linked above does.  GPS tags in the EXIF group are split into two tags, the actual number and the reference hemisphere (N/S/E/W).  The GPS time stamp is split into a date tag and a time tag.  The XMP GPS tags don't split the data, so it has to be combined to copy correctly.  Additionally, the XMP time stamp has a different name so it has to be translated.

Exiftool does create some composite GPS tags that do allow the data to be copied over more easily, but without knowing the full extent of your GPS data, the arg file is a more accurate solution.

QuoteIs that what's happening? Do you think there's a single command possible to transfer *all* metadata from my DNG's into XMP sidecars?

While there is some overlap in names between XMP and other metadata groups, quite a few need to translated. That's what the various arg files are used for. If you download and put the *2xmp arg files in the same directory as exiftool, you could use this command
exiftool -tagsfromfile @ -srcfile %d%f.xmp -@ iptc2xmp.args -@ exif2xmp.args -xmp:all -@ gps2xmp.args /path/to/files/

I didn't include the pdf2xmp.args in the above command but if you are processing PDFs, you can include it as well.
* 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).

thany

Brilliant! It seems to work! 😎

I would've hoped that exiftool was able to automagically convert from/to metadata sections, like how it's done with those args files. But at least it's possible.

StarGeek

I just saw your reddit post and I will point out another option.  And that is exiftool's own MIE sidecar file.  With that, you wouldn't have to worry about translating to XMP.  You could just save the EXIF, IPTC, and XMP tags to the MIE file and then copy them back to the extracted RAW.

Even that intermediate step could be skipped by using exiftool to extract the RAW image (OriginalRawImage) and then copy the data from the DNG to the RAW.
* 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).

thany

Hm, yeah maybe that would work. But I'm against changing the content of RAW files. They are, after all, RAW files - the exact data as it came out of the camera. It's a matter of principle of ocurse, and nothing is stopping anyone from changing metadata in RAW files, but to me it feels wrong to do so.

StarGeek

Quote from: thany on July 08, 2020, 06:04:24 AM
Hm, yeah maybe that would work. But I'm against changing the content of RAW files. They are, after all, RAW files - the exact data as it came out of the camera. It's a matter of principle of ocurse, and nothing is stopping anyone from changing metadata in RAW files, but to me it feels wrong to do so.

Then creating the XMP sidecars is the way to go then.  Completely understandable.
* 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).