ExifTool Forum

General => Metadata => Topic started by: Kottan on January 25, 2024, 03:59:50 PM

Title: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 25, 2024, 03:59:50 PM
I am using Exiftool a while in connection with other software like GPSBabel, but I just start diving in the details of GPS metadata handling. Now, I am struggling with a problem I can't solve by my own:
I took pictures with a new Canon R6 with and without GPS-E2 device connected, so I have different sets of GPS data depending on whether the GPS-E2 was connected at the time I took the picture or not.

For RAW format pictures (.CR3 format) taken without GPS-E2, I miss the following tags: GPS Time Stamp, GPS Map Datum, GPS Date Stamp and GPS Date/Time.

In order to add the missing GPS data in those pictures taken without the GPS-E2, I followed an earlier post in this forum and tried to generate two tags: composite:GPSdateStamp and composite:GPStimeStamp. However, I get a warning "Sorry, composite:GPSdateStamp doesn't exist or isn't writable", the same for the tag composite:GPStimeStamp.

The command line was as follows:
"C:\...\exiftool.exe" -composite:GPSdatestamp="2023:01:25" -composite:GPStimestamp="08:00:00" "C:\Users\...\Test_Image.cr3", where "..." stands for the correct paths.

What am I doing wrong? Any idea? Help would be highly appreciated. 
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Phil Harvey on January 25, 2024, 04:05:23 PM
Hi Kottan,

Try specifying the GPS group instead of Composite.

- Phil
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 25, 2024, 04:10:05 PM
Hi Phil,

Wow, the master himself! Tthat's what I call a quick answer ;)
Will try immediately.
So there is no reason why this action shouldn't work with .cr3 files, right?

Update #1:
I have modified the command now to "-GPS:datestamp="2023:01:25" -GPS:timestamp="08:00:00"
Return messages read:  "Warning: Tag 'GPS:datestamp' is not defined" and again "Warning: Sorry, GPS:TimeStamp doesn't exist or isn't writable"

Update #2:
Second try: I changed the tags to "-GPS:gpsdatestamp="2023:01:25" -GPS:gpstimestamp="08:00:00" . This time, I got a message "1 image files updated" and it seems to work. I will check with further image files to verify this.
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 25, 2024, 04:34:24 PM
Now, as it seems to work basically, I would like to make the next step.
For pictures not automatically geotagged I am using the freeware GeoSetter 3.5.3. Unfortunately, the guy who invented it does not support it any longer, the version did not change since 2019 and, as a result, I can't tag my CR3 files with this software but only the .JPG ones.

My planned workaround to add GPS data to my "non-geotagged" RAW files is to copy the GPS information from the manually geotagged JPG image files to the CR3 files in one go.

I am sure this work can be automated using a script/batch operation? As I am not familiar with scripting in connection with exiftool, does anybody have a recommendation or a link for me?
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Phil Harvey on January 25, 2024, 05:02:08 PM
You shouldn't need to write a script.  Something like this should copy the GPS information from CR3 to JPG if it doesn't exist already:

exiftool -if "not $gpslatitude" -tagsfromfile %d%f.CR3 -gps:all -ext jpg -r DIR

I'm testing for $gpslatitude here instead of $gps:all because some cameras write GPSVersionID even if they don't write the coordinates.

- Phil
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 26, 2024, 05:04:29 AM
Phil wrote:
QuoteSomething like this should copy the GPS information from CR3 to JPG if it doesn't exist already

It's the other way around, from JPG to CR3, but I do understand your point.
It would then read

exiftool -if "not $gpslatitude" -tagsfromfile %d%f.JPG -gps:all -ext CR3 -r DIR
Am I right?
Will test it.

Maybe for those who are interested in my current background:
The last days, I read a lot about synchronization of GPS data as well as GPS timestamp data. I am looking for a smart method to speed up this task instead of doing it manually, which may be time consuming, but it takes time to verify the information provided by those authors.
In particular, I need to create GPS data (coordinates, date/time) manually if the track, e.g. a city walk, is not tracked by any device (camera, separate tracker like Canon's GPS-E2, Garmin GPS device etc.). I can also imagine a split in my task like this:

Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 26, 2024, 06:44:00 AM
At first, I made a stupid mistake and thought it might not work. >:(
But now it's fine. Thanks!
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 30, 2024, 03:56:15 AM
As the files with different extension are stored in different directories, I would like to copy the GPS data (date/time, latitude, longitude, altitude if necessary) from .jpg files in directory A to .raw files in directory B.

I understand that the code "%d%f" defines both directory and filename.
How must it read, if the files are in different directories, provided that the filenames are identical for both .jpg and .raw?

Title: Re: GPS tags not existing or writable for CR3 files
Post by: Phil Harvey on January 30, 2024, 08:53:06 AM
%d is the directory part.  %f is the file name.  Change the %d to another directory name (ending with "/") if it is different than the source.

- Phil
Title: Re: GPS tags not existing or writable for CR3 files
Post by: Kottan on January 31, 2024, 03:58:43 AM
Thanks Phil,

Got it. I have modified your initial command proposal - it works with different directories now.

May I ask another question related to this?
Whilst checking the exiftool documentation, I couldn't find details about the use of "%", operators and conditions as in your proposal. In the FAQ, there are some examples, but I miss a complete documentation. As exiftool is written in Perl, which I am not familiar with: Can you recommend a source where I can find more details to better customize my exiftool controlled metadata operations? Thanks a lot in advance :)

Title: Re: GPS tags not existing or writable for CR3 files
Post by: StarGeek on January 31, 2024, 11:02:29 AM
Quote from: Kottan on January 31, 2024, 03:58:43 AMWhilst checking the exiftool documentation, I couldn't find details about the use of "%", operators

I almost posted the link yesterday. You can find details on the % variables under the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).  It is referred to under the -TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT), 3rd paragraph.  I'm pretty sure any other option that uses them also refers to the -w (-TextOut) option.

QuoteAs exiftool is written in Perl, which I am not familiar with: Can you recommend a source where I can find more details to better customize my exiftool controlled metadata operations?

I mostly learned Perl by searching on "Perl" and what I was attempting to do. The StackExchage sites usually pull up a code snippet that could accomplish it.  For more details and refreshers, I usually look over PerlMaven (https://perlmaven.com/).

I tend to find PerlDoc.Perl.org a bit too technical to figure things out and the formatting of PerlMonks.org harder to read, but those would be the major Perl sources.

RegEx is featured heavily in Perl and various commands here and a whole separate field to learn.  I used Regular-Expressions.info to learn and RegEx101.com to test expressions.