ExifTool Forum

ExifTool => Newbies => Topic started by: zierbeek on April 26, 2021, 04:00:27 AM

Title: KML or GPX sync with pictures MacOS
Post by: zierbeek on April 26, 2021, 04:00:27 AM
Hi all,

I have imported all my pictures using photoprism. Now they are all sorted in folders with Year-Month

From my trip in France, I have the kml from google timeline, day by day.
Would it be possible to sync a kml from each day with the pictures made on that day?
Or would it be better to merge all the kml's into 1?

Thanks in advance!
Matthias
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on April 26, 2021, 12:39:20 PM
From the docs on the Geotag option (https://exiftool.org/geotag.html#geotag)
QuoteMultiple GPS log files may be loaded simultaneously by using more than one -geotag option or -geotag= assignment in the same command. This allows batch processing of images spanning different tracks with a single command

So you could just put all the geotracks in the command.
Title: Re: KML or GPX sync with pictures MacOS
Post by: Phil Harvey on April 27, 2021, 11:03:18 AM
I've edited the documentation to also mention the wildcard feature in this sentence:

Multiple GPS log files may be loaded simultaneously by using more than one -geotag option or -geotag= assignment in the same command, or by using wildcards in the filename argument of the -geotag option.

- Phil
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on April 28, 2021, 11:01:10 AM
I tried these line, without success. something I'm missing?

exiftool -geotag=history-2020-09-11.kml smb://192.168.0.16/tank1/Photos/2020/09
exiftool -geotag=history-2020-09-11.kml //192.168.0.16/tank1/Photos/2020/09
exiftool -geotag=history-2020-09-11.kml 192.168.0.16/tank1/Photos/2020/09
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on April 28, 2021, 11:20:03 AM
You will probably need to copy the files over to a local directory.  I don't believe that exiftool can connect across smb.
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on April 28, 2021, 11:33:19 AM
nah that isn't an option since it's 800 gib.
Title: Re: KML or GPX sync with pictures MacOS
Post by: Phil Harvey on April 28, 2021, 01:51:20 PM
I'm no expert, but can't you mount the smb drive like you would an nfs drive?

- Phil
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 23, 2021, 08:45:56 AM
Hi all,

Back from my next trip and giving this another go.

I Used this command to geotag: exiftool -geotag=20210723053148-04063-data.gpx /Users/matthias/Desktop/Italië\ 2021\ Import

I have followed the page of the geotagging but can't figure this command out. I tried to sync but got the 'No writable tags' error. Then used the command to check the tags.
I have all of these. I see there is a DateTimeOriginal so I should be fine?
FileModifyDate                  : 2021:07:16 16:25:56+02:00
FileAccessDate                  : 2021:07:20 22:07:28+02:00
FileInodeChangeDate             : 2021:07:20 22:07:27+02:00
ModifyDate                      : 2021:07:16 16:25:56
DateTimeOriginal                : 2021:07:16 16:25:56
CreateDate                      : 2021:07:16 16:25:56
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on July 23, 2021, 01:12:15 PM
Is the time zone where you shot the pictures the same as the time zone of the computer you're running on?  If not, you need to either use -GeoSync to adjust the difference between the time zones or use -GeoTime to explicitly set the time.

For example, if I have an image taken in East Coast US (TZ -05:00) taken at 2013:01:28 18:47:15, the geotrack will show 2013:01:28 23:47:15Z.  I then return home to West Coast US (TZ-08:00).  I try to geotag directly I get this
C:\>exiftool -P -overwrite_original -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx y:\!temp\Test4.jpg
Warning: Time is too far beyond track in File:Geotime (ValueConvInv) - y:/!temp/Test4.jpg
Warning: No writable tags set from y:/!temp/Test4.jpg
    0 image files updated
    1 image files unchanged


That is because my local time zone is now -08:00 and exiftool will assume the local time zone of the computer.  So I have to shift this in one of two ways.  I can either explicitly add the time zone with GeoTime
C:\>exiftool -P -overwrite_original "-GeoTime<${DateTimeOriginal}-05:00" -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx  y:\!temp\Test4.jpg
    1 image files updated


Or I can use GeoSync to adjust the difference by taking the time zone of the the computer (-08:00) and subtracting the time zone of the location (-05:00) which gives -08:00-(-05:00) = -03:00
C:\>exiftool -P -overwrite_original -GeoSync=-3:0:0 -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx  y:\!temp\Test4.jpg
    1 image files updated


In your case, I'm guessing you can either use
exiftool -geotag=20210723053148-04063-data.gpx '-Geotime<${DateTimeOriginal}+02:00' /Users/matthias/Desktop/Italië\ 2021\ Import
or this (I don't know your time zone so I'm not sure if it will be -1:0:0 or -2:0:0)
exiftool -geotag=20210723053148-04063-data.gpx '-Geosync=-1:0:0"  /Users/matthias/Desktop/Italië\ 2021\ Import
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 23, 2021, 03:54:56 PM
Quote from: StarGeek on July 23, 2021, 01:12:15 PM
Is the time zone where you shot the pictures the same as the time zone of the computer you're running on?  If not, you need to either use -GeoSync to adjust the difference between the time zones or use -GeoTime to explicitly set the time.

For example, if I have an image taken in East Coast US (TZ -05:00) taken at 2013:01:28 18:47:15, the geotrack will show 2013:01:28 23:47:15Z.  I then return home to West Coast US (TZ-08:00).  I try to geotag directly I get this
C:\>exiftool -P -overwrite_original -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx y:\!temp\Test4.jpg
Warning: Time is too far beyond track in File:Geotime (ValueConvInv) - y:/!temp/Test4.jpg
Warning: No writable tags set from y:/!temp/Test4.jpg
    0 image files updated
    1 image files unchanged


That is because my local time zone is now -08:00 and exiftool will assume the local time zone of the computer.  So I have to shift this in one of two ways.  I can either explicitly add the time zone with GeoTime
C:\>exiftool -P -overwrite_original "-GeoTime<${DateTimeOriginal}-05:00" -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx  y:\!temp\Test4.jpg
    1 image files updated


Or I can use GeoSync to adjust the difference by taking the time zone of the the computer (-08:00) and subtracting the time zone of the location (-05:00) which gives -08:00-(-05:00) = -03:00
C:\>exiftool -P -overwrite_original -GeoSync=-3:0:0 -geotag=Y:\Data\dump\Text\Geotracks\2013-01-28_152504.gpx  y:\!temp\Test4.jpg
    1 image files updated


In your case, I'm guessing you can either use
exiftool -geotag=20210723053148-04063-data.gpx '-Geotime<${DateTimeOriginal}+02:00' /Users/matthias/Desktop/Italië\ 2021\ Import
or this (I don't know your time zone so I'm not sure if it will be -1:0:0 or -2:0:0)
exiftool -geotag=20210723053148-04063-data.gpx '-Geosync=-1:0:0"  /Users/matthias/Desktop/Italië\ 2021\ Import

Hi, Thanks for your answer.
I would not know if I would need to use geosync or geotime since I am in the same timezone as the camera, and the trip we did. My timezone is gmt +2 , central Europe :)
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on July 23, 2021, 04:23:05 PM
Quote from: zierbeek on July 23, 2021, 03:54:56 PM
I would not know if I would need to use geosync or geotime since I am in the same timezone as the camera, and the trip we did. My timezone is gmt +2 , central Europe :)

If that's the case then you'll have to look at the GPX files to look at the <time> entries.  The GPX time entries should be two hours before the time listed in the file.  So in your example, the image is showing a DateTimeOriginal of "2021:07:16 16:25:56" and you would need to verify there's a time entry that would be around "2021:07:16 14:25:56".
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 23, 2021, 04:24:58 PM
Quote from: StarGeek on July 23, 2021, 04:23:05 PM
Quote from: zierbeek on July 23, 2021, 03:54:56 PM
I would not know if I would need to use geosync or geotime since I am in the same timezone as the camera, and the trip we did. My timezone is gmt +2 , central Europe :)

If that's the case then you'll have to look at the GPX files to look at the <time> entries.  The GPX time entries should be two hours before the time listed in the file.  So in your example, the image is showing a DateTimeOriginal of "2021:07:16 16:25:56" and you would need to verify there's a time entry that would be around "2021:07:16 14:25:56".

Got it working man, just used the standard kml output from google timeline, not the converted to gpx file! :) Now a way to merge all of the kml's into 1
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 23, 2021, 04:31:29 PM
No succes with merged kml file, so going through all of them one by one
changing each day and so checking all pictures and only changing the ones on that day. Is there a faster way? No worries if there isn't ;)
exiftool -geotag=history-2021-07-04.kml /Users/matthias/Desktop/Italië\ 2021\ Import



Also, some of the pictures do have a geolocation, others not. Due to interpolation i guess?


About the geosync, Time stap of created image and gps are indeed 2h apart. Do i need to do the +2 in that case?
(https://i.imgur.com/srT5b0v.png)
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on July 23, 2021, 05:58:12 PM
Quote from: zierbeek on July 23, 2021, 04:24:58 PMNow a way to merge all of the kml's into 1

Don't bother.  From the Geotag docs (https://exiftool.org/geotag.html#geotag)
    Multiple GPS log files may be loaded simultaneously by using more than one -geotag option or -geotag= assignment in the same command, or by using wildcards in the filename argument of the -geotag option. This allows batch processing of images spanning different tracks with a single command. When using wildcards the argument may need to be quoted on some systems to prevent shell globbing, but note that wildcards are not supported with the -geotag= syntax.

Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on July 23, 2021, 05:59:54 PM
Quote from: zierbeek on July 23, 2021, 04:31:29 PM
About the geosync, Time stap of created image and gps are indeed 2h apart. Do i need to do the +2 in that case?

You shouldn't need it.  If you're in time zone +02:00 and the time in the trace is two hours before that, then that should work correctly.
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 24, 2021, 12:09:14 PM
Thanks!

So no adjustment.  Some pictures between others do not get a geotag assigned. is this expected. They fall in between images on the same day and about the same timestamp which get a geotag assigned.
Title: Re: KML or GPX sync with pictures MacOS
Post by: Phil Harvey on July 25, 2021, 06:53:38 AM
Try geotagging these images again, but use the -v option.  This should tell you what the problem is.  My guess is the fixes in the GPS track are too far apart, but this can be fixed by adjusting the GeoMaxIntSecs (https://exiftool.org/ExifTool.html#GeoMaxIntSecs) and GeoMaxExtSecs API parameters.  Something like this:

exiftool -api geomaxintsecs=7200 ...

- Phil
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on July 25, 2021, 10:42:37 AM
Thanks Phil, will try that. Now i edited them manually in Digikam, not that big of a pain in the ass :p
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on August 21, 2021, 05:09:37 AM
Hmm
is there a syntax error in this? I navigated to the folder where my pictures are and also put a logs folder in there with the KML's

exiftool -api geomaxintsecs=15000 -geotag /Volumes/tank1/Photoprism/Photos/2019/07/logs/* /Volumes/tank1/Photoprism/Photos/2019/07/*

I get the error that it's to far beyond. Should i increase the geomaxint?
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on August 21, 2021, 11:37:01 AM
Quote from: zierbeek on August 21, 2021, 05:09:37 AM
I get the error that it's to far beyond. Should i increase the geomaxint?

Try adding the -v2 (-verbose) option (https://exiftool.org/exiftool_pod.html#v-NUM--verbose) as described in Troubleshooting Geotagging #3 (https://exiftool.org/geotag.html#TR3).  The output will show you what time range the geotrack is using and what time is being used for the image.  In most cases you would just add the geosync option (https://exiftool.org/geotag.html#geosync) to shift the timing to match.

For example, normally I'm West coast US, -07:00 time zone currently.  But if I took a trip to New York, East coast US, -04:00, took pictures and geotrack, and tried to geotag when I got home, exiftool would be applying my local time zone of -07:00 by default and the files would be off.

So, in this example, it shows that the GPS track is at noon UTC, but the time set for the file is 15:00:00 UTC.  If I set -geosync to subtract 3 hours, (my -07:00 timezone minus the locations -04:00 timezone, e.g. -07:00-(-04:00)=-03:00) the command works.
C:\>exiftool -P -overwrite_original -geotag out.gpx y:\!temp\Test4.jpg  -v2
Argument "-Geotime<DateTimeOriginal#" is assumed
Loaded 1 points from XML-format GPS track log file 'out.gpx'
  GPS track start: 2021:08:21 12:00:00.000 UTC
  GPS track end:   2021:08:21 12:00:00.000 UTC
Writing File:Geotag
======== y:/!temp/Test4.jpg
Setting new values from y:/!temp/Test4.jpg
  Geotime value:   2021:08:21 15:00:00.000 UTC (local timezone is -07:00)
Warning: Time is too far beyond track in File:Geotime (ValueConvInv) - y:/!temp/Test4.jpg
Warning: No writable tags set from y:/!temp/Test4.jpg
Nothing changed in y:/!temp/Test4.jpg
    0 image files updated
    1 image files unchanged

C:\>exiftool -P -overwrite_original -geosync=-3:0:0 -geotag out.gpx y:\!temp\Test4.jpg 
    1 image files updated

Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on October 05, 2021, 09:37:08 AM
I thought I would succeed this time but unfortunately not...

I went on a trip to Romania which is a one hour difference with my country. Belgium is UTC+2 and Romania UTC+3. The camera was set to Belgium. The kml I have is on UTC+2. I thought it should work this way:

exiftool -GeoSync=-01:00 -geotag *.kml /Users/matthias/Desktop/Roemenië\ 2021/


but no luck:
Warning: Time is too far beyond track in File:Geotime (ValueConvInv) - /Users/matthias/Desktop/Roemenië 2021/DSCF7481.JPG
Warning: No writable tags set from /Users/matthias/Desktop/Roemenië 2021/DSCF7481.JPG


The kml was taken with google timeline and 4g was enabled all the time to improve accuracy
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on October 05, 2021, 10:48:33 AM
You need to geosync from the camera time, which you say is +02:00, to UTC.  So it should be -02:00.

As I said, add -v2 to the command and exiftool will tell you what time it is actually using and make adjustments based upon that.
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on October 05, 2021, 10:59:02 AM
Around 250 images get edited, 2300 don't get tagged.

Setting new values from /Users/matthias/Desktop/Roemenië 2021/DSCF7827.RAF
  Geotime value:   2021:09:13 11:11:59.000 UTC (incl. Geosync offset of -7200.000 sec) (local timezone is +04:00)
Warning: Time is too far beyond track in File:Geotime (ValueConvInv) - /Users/matthias/Desktop/Roemenië 2021/DSCF7827.RAF
Warning: No writable tags set from /Users/matthias/Desktop/Roemenië 2021/DSCF7827.RAF
Nothing changed in /Users/matthias/Desktop/Roemenië 2021/DSCF7827.RAF
Title: Re: KML or GPX sync with pictures MacOS
Post by: StarGeek on October 05, 2021, 11:10:02 AM
So the file DSCF7827.RAF using a time of "2021:09:13 11:11:59.000 UTC", adjusted by your computer's local timezone of +04:00.  Take a look at what DateTimeOriginal is set to in the file and figure out what time you need to set it to to be part of the geotrack and GeoSync based upon the difference.
Title: Re: KML or GPX sync with pictures MacOS
Post by: zierbeek on October 05, 2021, 11:49:16 AM
thanks again for your help.

It seemed that it was a syntax error!

works:
exiftool -v2 -GeoSync=-02:00:00 -geotag "*.kml" /Users/matthias/Desktop/Roemenië\ 2021/*

doesn't work:
exiftool -v2 -GeoSync=-02:00:00 -geotag *.kml /Users/matthias/Desktop/Roemenië\ 2021/*
Title: Re: KML or GPX sync with pictures MacOS
Post by: Phil Harvey on October 05, 2021, 12:52:03 PM
Yes.  MacOS and Linux will expand *.kml on the command line unless you put it in quotes, and the -geotag option requires a single argument so expanding into multiple file names doesn't work.

- Phil