How to copy GPS info in NEF to XMP?

Started by stasiana, March 10, 2012, 01:27:19 PM

Previous topic - Next topic

stasiana


I previously geotagged a lot of NEF files directly by adding in the EXIF GPS tags.

I would like to copy them into their corresponding XMP tags now. I cannot figure out the command to do this for a directory full of files. Can someone help?


Phil Harvey

There is an argument file called "gps2xmp.args" in the full exiftool distribution that contains these mappings:

-XMP:all < GPS:all
-XMP:GPSLatitude < Composite:GPSLatitude
-XMP:GPSLongitude < Composite:GPSLongitude
-XMP:GPSDateTime < Composite:GPSDateTime


With this file in the current directory, you can copy the GPS to XMP in the NEF files with this command:

exiftool -@ gps2xmp.args -ext nef DIR

where DIR is the name of the directory containing the NEF images.  Add the -r option to also process NEF files in sub-directories.

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


stasiana


Hello again,

I just tried this method (didn't have an opportunity until now), and I while exiftool changes the NEF file itself, it didn't seem to update the XMP files. They are unchanged. It exiftool itself told me it had modified the files. Am I doing something wrong?

Log below:

$ cat gps2xmp.args
#------------------------------------------------------------------------------
# File:         gps2xmp.args
#
# Description:  Argument file for copying GPS information from EXIF to XMP
#
# Usage:        exiftool -tagsFromFile SRCFILE -@ gps2xmp.args DSTFILE
#
# Requires:     ExifTool version 6.75 or later
#
# Revisions:    2009/01/09 - P. Harvey Created
#
# Notes:        Most of the GPS tags are copied by the first argument, but
#               the XMP GPS coordinate and date/time tags are composites of
#               more than one EXIF GPS tag, so they are handled separately.
#------------------------------------------------------------------------------
-XMP:all < GPS:all
-XMP:GPSLatitude < Composite:GPSLatitude
-XMP:GPSLongitude < Composite:GPSLongitude
-XMP:GPSDateTime < Composite:GPSDateTime
# end
$ ls -l
total 83728
-rw-r--r--  1 aa  admin  10475704 19 Mar 09:50 20110917T191737 -  Turkey.NEF
-rw-r--r--  1 aa  admin  10369908 19 Mar 09:50 20110917T191743 -  Turkey.NEF
-rw-r--r--  1 aa  admin  11303266 19 Mar 09:50 20110917T193944 -  Turkey.NEF
-rw-r--r--  1 aa  admin  10709920 19 Mar 09:50 20110917T194107 -  Turkey.NEF
-rw-r--r--  1 aa  admin       816 19 Mar 09:51 gps2xmp.args
$ exiftool -@ gps2xmp.args -ext NEF .
    1 directories scanned
    4 image files updated
$ ls -l
total 167480
-rw-r--r--  1 aa  admin  10478766 19 Mar 09:52 20110917T191737 -  Turkey.NEF
-rw-r--r--  1 aa  admin  10475704 19 Mar 09:50 20110917T191737 -  Turkey.NEF_original
-rw-r--r--  1 aa  admin  10372970 19 Mar 09:52 20110917T191743 -  Turkey.NEF
-rw-r--r--  1 aa  admin  10369908 19 Mar 09:50 20110917T191743 -  Turkey.NEF_original
-rw-r--r--  1 aa  admin  11306324 19 Mar 09:52 20110917T193944 -  Turkey.NEF
-rw-r--r--  1 aa  admin  11303266 19 Mar 09:50 20110917T193944 -  Turkey.NEF_original
-rw-r--r--  1 aa  admin  10712980 19 Mar 09:52 20110917T194107 -  Turkey.NEF
-rw-r--r--  1 aa  admin  10709920 19 Mar 09:50 20110917T194107 -  Turkey.NEF_original
-rw-r--r--  1 aa  admin       816 19 Mar 09:51 gps2xmp.args
$

Phil Harvey

ExifTool only writes the files you tell it to.  If you want to copy GPS in the NEF to XMP in a sidecar file, you must specify this on the command line.  See the metadata sidecar files page for examples and more information.

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