How to change GPSDateTime field

Started by tillea, July 26, 2017, 05:08:23 AM

Previous topic - Next topic

tillea

Hi,

after my first beginner question how to change the DateTime field I'm trying hard to reset GPSDateTime.  The reason is that I messed up the adjustment of GPS data a bit and some code I wrote relies on GPSDateTime and sets all other dates accordingly - in this case to the wrong time.  What I tried is:


$ exiftool -a -G -s  20170709_113855_DSC-RX100_dsc01370.jpg  | grep -i gps.*time
[EXIF]          GPSTimeStamp                    : 04:38:55
[Composite]     GPSDateTime                     : 2017:07:09 04:38:55Z
$ exiftool -a -Composite:GPSDateTime   20170709_113855_DSC-RX100_dsc01370.jpg
GPS Date/Time                   : 2017:07:09 04:38:55Z
$ exiftool -a -Composite:GPSDateTime-="0:0:0 0:1:17"   20170709_113855_DSC-RX100_dsc01370.jpg
Warning: Tag 'Composite:GPSDateTime' does not exist
Nothing to do.
$ exiftool -a -Composite:GPSDateTime=   20170709_113855_DSC-RX100_dsc01370.jpg
Warning: Tag 'Composite:GPSDateTime' does not exist
Nothing to do.


I simply fail to understand why I can display a tag Composite:GPSDateTime but if I try to set it I get the warning that it does not exist.  It was similar with DateTime but I obviously fail to understand the logic behind this.  Phil wrote in the other thread https://exiftool.org/forum/index.php/topic,8427.msg43327.html#msg43327 that it is a performance issue to write only known tags.  I would be super happy if there would be some --force option to be able to write any tag (specifically those existing inside the image) at the expense of some performance.  The time I've spent with seeking in a solution would be outperformed by far even by a slower exiftool.

Finally even removing GPSDateTime would be OK since I know that setting  -GPSLatitudeRef -GPSLatitude -GPSLongitudeRef -GPSLongitude  works nicely (and for the actual image in question I could even live without this information if I could only get rid of the wrong GPSDateTime.

Kind regards, Andreas.

Hayo Baan

Composite tags can not be written in general (there are a couple of exceptions). What you need to do is write to the components that together make up the composite tag. In this case I'm not sure what tags are used to get the date part, but that should be easy to find out. So check all tags with a date and correct the one that is wrong. That should solve your issue.
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

#2
You should be changing GPSTimeStamp and GPSDateStamp (the tags from which Composite:GPSDateTime is derived).  The only trick is handling the rollover to the previous day, which can easily be done first, like this:

1. exiftool -gpsdatestamp-=1 -if "$gpstimestamp lt '00:01:17'" DIR

2. exiftool -gpstimestamp-=00:01:17 DIR

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

Hayo Baan

Quote from: Phil Harvey on July 26, 2017, 08:40:18 AM
You should be changing GPSTimeStamp and GPSDateStamp (the tags from which Composite:GPSDateTime is derived).

I had assumed GPSDateStamp was missing as I didn't see it in the output, but now I see he only selected the gps*time tags... So yes, yes the solution is as easy as you said :)
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

Is GPSDateTime really incorrect though?  GPSDateTime is UTC time, if I recall, so if @tillea's time zone is 7 hours off of UTC, then it might not be incorrect.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype