Timezone issue when geotagging

Started by gyrex, March 19, 2019, 08:15:09 AM

Previous topic - Next topic

gyrex

Hi everyone,

I've been using exiftool for a couple of years now but ran into an interesting issue the other day and I'm hoping someone might be able to help me if possible?

I took some photos the other day in Brisbane, Australia (UTC +10) then I had to fly to Sydney (UTC +11). My Macbook changed timezone to Sydney automatically and when I went to geotag my photos using KML's I download from my Google Maps Timeline, I noticed that the photos were all geotagged incorrectly using my positions an hour ahead of where they should have been.

I fixed them afterwards by manually setting my timezone back to Brisbane time but I was wondering why it did this? I would have thought that it would have worked out the timezones itself? Is there any way to fix this for future (albeit unlikely) scenarios where I'm in a different timezone to where I took the photos?

Many thanks in advance and thanks for a sensational tool!

John


Phil Harvey

Hi John,

If no time zone is specified when setting the Geotime, then the system time zone is assumed.  If this is different than the time zone of the camera, then you will have this problem.

By default, "-Geotime<DateTimeOriginal#" is assumed when geotagging unless otherwise specified.  The best option would be to use a tag other than DateTimeOriginal which has time zone information, but if this isn't available from your camera then a work-around is to add a timezone manually.  See the geotime section here for details.

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

gyrex

#2
Wow, thanks for your prompt response Phil.

I did read the geotime section but I must admit, I was a little confused by most of that section. My camera (Sony a7R3) does include some offset information (does this satisfy your timezone information) and can I use this to geotag correctly? I'm sorry if I'm asking stupid questions but I'm honestly confused by the geotag section. Here's an output from one of my raw files:

[System]        FileModifyDate                  : 2019:03:15 12:05:38+11:00
[System]        FileAccessDate                  : 2019:03:19 23:37:20+11:00
[System]        FileInodeChangeDate             : 2019:03:17 08:47:11+11:00
[IFD0]          ModifyDate                      : 2019:03:15 11:05:39
[ExifIFD]       DateTimeOriginal                : 2019:03:15 11:05:39
[ExifIFD]       CreateDate                      : 2019:03:15 11:05:39
[ExifIFD]       OffsetTime                      : +10:00
[ExifIFD]       OffsetTimeOriginal              : +10:00
[ExifIFD]       OffsetTimeDigitized             : +10:00
[Sony]          SonyDateTime                    : 2019:03:15 11:05:39
[IFD1]          ModifyDate                      : 2019:03:15 11:05:39
[Composite]     SubSecCreateDate                : 2019:03:15 11:05:39+10:00
[Composite]     SubSecDateTimeOriginal          : 2019:03:15 11:05:39+10:00
[Composite]     SubSecModifyDate                : 2019:03:15 11:05:39+10:00


Edit: Modified to include exif output per Phil's suggestion below

Phil Harvey

Things would be much more clear if you had extracted the information with this command (a la FAQ 3):

exiftool -time:all -a -G1 -s FILE

which makes the SubSecDateTimeOriginal tag more apparent.  So this should do what you want:

exiftool -geotag your.kml "-geotime<subsecdatetimeoriginal" 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 ($).

DvO

I had essentially the same issue, geotagging photos using '-geotime<${{DateTimeOriginal}' of an last summer's extended loop from Germany (central Europe) over the Baltic states through Scandinavia, switching between CEST (UTC+2) and EEST (UTC+3) forth and back even two times (due to traveling along the border of Norway and Finland on the way south).

The photos taken while my Android phones were logged in mobile networks based on CE(S)T timezone were tagged correctly (which is surprising in itself because the geotagging happened in winter while being in CET, i.e., with no daylight saving time), but the geotags of photos taken in EEST were off by one hour.
I feel this is a bug since the DateTimeOriginal tags, as reported by exiftool version 12.76 (e.g., 2024:08:13 08:17:00+03:00) do include time zone information. Yet this information gets ignored, while https://exiftool.org/geotag.html says:
QuoteLocal system time is assumed unless DateTimeOriginal# contains a timezone

After some experimentation, I came up with this workaround: '-geotime<${DateTimeOriginal}${OffsetTimeOriginal}'

Phil Harvey

#5
You must have more than one DateTimeOriginal in your file.  Run this command:

exiftool -a -G1 -s "-*datetimeoriginal" FILE

Then specify the one that has the time zone in your command (likely XMP-exif):

exiftool '-geotime<${xmp-exif:DateTimeOriginal}' ...

- Phil

Edit: Changed first command to also catch SubSecDateTimeOriginal
...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 ($).

DvO

Indeed! Thanks Phil for your very swift and helpful response.

[ExifIFD]       DateTimeOriginal                : 2024:07:23 18:27:09
[Composite]     SubSecDateTimeOriginal          : 2024:07:23 18:27:09.750+03:00

I had been confused by, e.g., exiftool -*Time* reporting both tags with the same label:
Date/Time Original              : 2024:07:23 18:27:09
...
Date/Time Original              : 2024:07:23 18:27:09.750+03:00

Using '-geotime<${SubSecDateTimeOriginal}' seems to work fine similarly to my above workaround (while the output can be a couple of meters off, likely due to the extra (sub-second) resolution.

Using '-geotime<${xmp-exif:DateTimeOriginal}' does not work for me:
    1 image files unchanged

Phil Harvey

Right.  SubSecDateTimeOriginal was my 2nd guess, and that did the trick.  Your file didn't contain XMP-exif:DateTimeOriginal.

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

DvO

Could you please improve the default value taken by exiftool (in case -geotime is not given) such that it prefers using
SubSecDateTimeOriginal if present, otherwise the concatenation of DateTimeOriginal and OffsetTimeOriginal
and update https://exiftool.org/geotag.html accordingly?

Phil Harvey

Just to let you know the history on this one:  The ExifTool -geotag feature was added 8 years before the EXIF specification added the time zones.

I am really careful about changing things that affect existing behaviour, so I will have to think carefully about this suggestion.

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

Phil Harvey

I've patched ExifTool 13.18 to set Geotime from DateTimeOriginal and SubSecDateTimeOriginal as you suggested.  We'll see how this goes.

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

DvO

I've just tried out ExifTool 13.19.
Now the time zone info is correctly taken into account also without explicitly using '-geotime<${SubSecDateTimeOriginal}' or the like.

Thanks a lot Phil!

DvO

As the fallback solution in case SubSecDateTimeOriginal is not available,
I believe that instead of '-geotime<${DateTimeOriginal}' it should be better to use
'-geotime<${DateTimeOriginal}${OffsetTimeOriginal}' because the time zone info is then added if available.

Phil Harvey

If DateTimeOriginal and OffsetTimeOriginal are available then SubSecDateTimeOriginal will also be available (it is a Composite tag based on these other tags).

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