writing gps data with direction

Started by chrisn, April 14, 2015, 12:28:12 PM

Previous topic - Next topic

chrisn

I thought I was well on the way to an applescript app to pick up the longitude, latitude and direction from Google Earth and then a quick do shell script "exiftool ..." to write the values back to the selected image together with some keywords like geocoded and looking north.
with a line like

exiftool  -GPSLongitudeRef=E  -GPSLatitude=53.794933543404 -GPSLatitudeRef=N  -GPSLongitude=-1.446520451205 -GPSAltitudeRef=0  -GPSAltitude=0  -GPSImgDirection=213 -GPSImgDirectionRef=T -keywords="Geocoded, Looking South West"


Examining some of the previously done images some data is in EXIF and some in XMP as you can see below.
I am happy enough to write it into several places at the same time but I could do with some guidance on which ones.
I also recall one post made some comment about setting IPCTdigest to new, do I also need to do this to ensure programs like lightoom read and update all the correct fields?

Any advice greatly appreciated.

Chris-Newports-iMac:~ chrisnewport$ exiftool -a -G1 "-gps*" /users/chrisnewport/Pictures/21050219/IMG_5766.jpg
[GPS]           GPS Version ID                  : 2.2.0.0
[GPS]           GPS Latitude Ref                : North
[GPS]           GPS Latitude                    : 41 deg 22' 36.96"
[GPS]           GPS Longitude Ref               : East
[GPS]           GPS Longitude                   : 2 deg 11' 23.45"
[XMP-exif]      GPS Version ID                  : 2.2.0.0
[XMP-exif]      GPS Latitude                    : 41 deg 22' 36.96" N
[XMP-exif]      GPS Longitude                   : 2 deg 11' 23.45" E
[Composite]     GPS Latitude                    : 41 deg 22' 36.96" N
[Composite]     GPS Latitude Ref                : North
[Composite]     GPS Longitude                   : 2 deg 11' 23.45" E
[Composite]     GPS Longitude Ref               : East
[Composite]     GPS Position                    : 41 deg 22' 36.96" N, 2 deg 11' 23.45" E

Phil Harvey

Personally I would use EXIF GPS for JPEG files.  You can sync between this and XMP using the gps2xmp.args and xmp2gps.args files in the full ExifTool distribution.  These argfiles do not set the IPTCDigest -- I don't think this is necessary because none of the GPS tags have IPTC counterparts.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

Thanks for the feedback Phil,

As the code would also be writing other data into the keywords (an IPTC field), and Hierarchical Subject (XMP-lr field), does your comment about not setting the IPTCDigest still apply?


Phil Harvey

No.  You should always update IPTCDigest when writing IPTC if the digest was correct before and your update preserves the XMP/IPTC synchronization.

If the digest was wrong, then you have some work to do in reconciling the differences.  Here is one way synchronize the IPTC and XMP before you start:

exiftool -@ iptc2xmp.args -if "$iptcdigest ne $currentiptcdigest" DIR

However this isn't a 100% solution (because it doesn't handle things like tags deleted from IPTC).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

Hi Phil,

after several attempt I realised I had only installed the dmg and things woldn't work without a full install, after several attemps including updating perl I am still getting
Chris-Newports-iMac:~ chrisnewport$ exiftool -@ iptc2xmp.args -if '$iptcdigest ne $currentiptcdigest' /Users/chrisnewport/Pictures/21050219
Error opening arg file iptc2xmp.args


I have obviously missed something simple but what? Why is it having a problem with the arg file?

Chris

Phil Harvey

Hi Chris,

The command assumes the argfile is in the current directory.  Grab it from the arg_files directory of the full distribution.  This is the only file you need that wasn't in the dmg install.

I hope you didn't also do the Unix install, because if so you may have problems down the road if you update one installation but not the other.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

I think I'm in a mess.
I did do a Unix install, and have supposedly updated perl as well to version 16 but I only can see folders for Perl 5.8.9 and 5.10.0, yet the exiftool notes quote "...individual libraries in /Library/Perl/#.#.#, where "#.#.#" is your Perl version"
and I am getting
Chris-Newports-iMac:~ chrisnewport$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for darwin-thread-multi-2level
So why can I not see a folder for Perl 5.16.3?

Anyway forgetting the Perl issues should I get rid of exiftool completely and start again? (if so where do I need to check that it has been removed?)

Is there a better place for the args file than the current directory , which is the user directory?

Chris

Phil Harvey

Hi Chris,

You can put the argfile wherever you want.  The argfiles are for convenience only, and save you from typing lots of ExifTool arguments.

Regarding uninstalling the Unix ExifTool... I'm guessing that your Perl installation maybe went into somewhere like /opt/local instead of the normal OS X location of /Library/Perl.  No problem though, just run "sudo make uninstall" in the ExifTool distribution folder to see where the ExifTool files went, then delete them manually (I'm assuming that you will get the "Uninstall is unsafe" message, which is not applicable to ExifTool since it relies on no other libraries).

- Phil

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

Hi Phil,

The advice has been useful, but now I am having problems something in the code seems to be writing into a field called subject
The code being applied is
exiftool  -GPSLongitudeRef=E  -GPSLatitude=51.646952171244 -GPSLatitudeRef=N  -GPSLongitude=-0.259445226698 -GPSAltitudeRef=above  -GPSAltitude=0  -GPSImgDirection=82 -GPSImgDirectionRef=T -hierarchicalsubject-=NotGeocoded -keywords-=NotGeocoded -hierarchicalsubject+=Geocoded -hierarchicalsubject+=View_Looking_East -keywords+=Geocoded -keywords+=View_Looking_East -@ /Users/chrisnewport/GeoDirection.app/Contents/Resources/iptc2xmp.args -overwrite_original /Users/chrisnewport/Pictures/img015.jpg"


Any thoughts?

Chris


Phil Harvey

Hi Chris,

Yes.   Take a look at the iptc2xmp.args file you are using.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

Hi Phil,

Looking at the arg file as you suggested I can see that section -XMP-dc:Subject < IPTC:Keywords which would be putting something into the field, but it is the old value.
I presume I could manually overwrite the subject field, but I am wondering if I have the sequence of instructions in the best order.

Likewise I presume I could write my own variant on the args file that contains some of the actions that occur every time like removing NotGeocoded and adding Geocoded

Chris

Phil Harvey

Hi Chris,

It sounds like you should either sync the XMP from the IPTC then write the tags you want to both IPTC and XMP, or write the tags you want to IPTC then sync the XMP afterwards.  The first option may be done with a single ExifTool command, but the second would take two (because ExifTool always copies the original values).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chrisn

Hi Phil,

Thanks for all the advice, I took the option of using two calls to Exiftool and its working like a dream.
The only problem in now I'm thinking of all the ways it could get improved rather than getting on with the tagging work.

Thanks again for all your help and such a useful application

Chris