Hi All,
I have a folder of JPG files. Some of the files contain no GPS tagging information, while others (mainly from an iPhone) already contain valid GPS metadata. I would like to preserve the original GPS data whenever possible rather than overwrite it with info from my GPX files.
So, is there anyway to tell exiftool not to write any GPS-related tags to files containing existing GPS metadata while still batch processing an entire folder?
Thanks in advance,
Michael
Hi Michael,
Here are a couple of ways to do things that are close to what you want:
1. Don't process a file if it has any GPS:
exifool -if "not $gps:all" ...
2. Don't write any tags that already exist:
exiftool -wm cg ...
- Phil
Hi Phil,
Thanks for the quick reply. I'm sure the first option will work for me. I'm not sure why using an "-if" statement didn't occur to me. If it had, I wouldn't have needed to trouble you!
I'm curious about the -writemode option (-wm cg), however. If a JPG has gps data in EXIF, is there any chance exiftool's geotagging will create a second set of GPS information in, say, XMP? I can foresee some issues if the GPS data in my GPX file varies by a few meters from the data recorded by the iPhone. I wouldn't want to end up with two sets of GPS tags that differed slightly from one another.
Michael
From the ExifTool Geotagging page (https://exiftool.org/geotag.html):
By default, GPS tags are created in EXIF and the corresponding XMP tags are updated only if they already exist. However, an EXIF or XMP group name may be specified to force writing only to the specified location. For example, writing XMP:Geotime or EXIF:Geotime will write the generated GPS tags only to XMP or EXIF respectively. Note that when written to XMP, the GPSLatitudeRef and GPSLongitudeRef tags are not used, and the XMP GPSDateTime tag is written instead of the separate EXIF GPSDateStamp and GPSTimeStamp tags.
- Phil
Quote from: Phil Harvey on June 28, 2016, 07:35:49 AM
1. Don't process a file if it has any GPS:
exifool -if "not $gps:all" ...
Depending upon the camera, this may not be enough. My Nikons include
GPSVersionID in the images by default (no other gps data) and would be skipped by this command. When I was first attempting to add gps data to my images with Exiftool, I had to use an actual coordinate tag, like
GPSLatitude or
GPSLongitude.
If you're on Windows, you might check out Geosetter (http://www.geosetter.de/en/). It's a gui that uses Exiftool to write the data. It'll also figure out extras like altitude (if not already part of your geotrack), time zones, and standard or daylight savings time for you.
StarGeek-
You are correct. I see the same issue with my Canon files -- they include GPSVersionID and no other gps data. I need something like:
exiftool -if "not $gps:all-except-GPSVersionID", but of course this exists only in my imagination!
I guess I could go through and first remove all the GPSVersionID tags, but I hate to have to run this extra step.
-Michael
Use something like:
exifool -if "not $GPSLatitude"
If it doesn't have the GPSLatitude (or GPSLongitude) tag, then it's probably one you need to add data to. While it's technically possible to have only GPSLatitude or GPSLongitude, it seems unlikely, though you could check -if "not ($GPSLatitude and $GPSLongitude)" to be sure.
Quote from: StarGeek on June 28, 2016, 01:51:08 PM
Use something like:
exifool -if "not $GPSLatitude"
If it doesn't have the GPSLatitude (or GPSLongitude) tag, then it's probably one you need to add data to. While it's technically possible to have only GPSLatitude or GPSLongitude, it seems unlikely, though you could check -if "not ($GPSLatitude and $GPSLongitude)" to be sure.
I think you mean
-if "not ($GPSLatitude or $GPSLongitude)" ;)
(and remember to use single quotes if you're on Mac/Linux)
Yep, that's what I meant.
No... wait... I think I was right the first time.
-if "not ($GPSLatitude or $GPSLongitude)" means that if only one of the tags exists, then the file will not be processed. While there may be an occasion where this would be acceptable, personally I would not consider this valid gps coord and want to get the correct Lat and Long into the file.
-if "not ($GPSLatitude and $GPSLongitude)" would require both to exist (i.e. having completed gps data) for the condition to be false and make sure the file is not processed.
Edit
When it comes down to it, it probably doesn't make any difference. I would doubt that most software (except Exiftool) would allow you to only put in only Lat or Long. So both tags are either going to be there or not. And in that case, both -if "not ($GPSLatitude or/and $GPSLongitude)" give the same results.