Announcing gps_retag and question on conditional gps retagging.

Started by marcmerlin, August 06, 2012, 03:01:31 AM

Previous topic - Next topic

marcmerlin

Hi,

I wrote a script for cameras that have a built in GPS to allow retagging pictures with a better location if one is available, see: http://marc.merlins.org/linux/gps_retagging/ for details and http://marc.merlins.org/linux/scripts/gps_retag for the script.

I'm however currently using gpsPhoto to geotag pictures because it lets me specify an argument of how much offset is allowed for a GPX point to be used for geotagging and have not found a way to do this with exiftool.

Questions
1) Can exiftool be told "only retag with a point from this GPX file if the time offset is less than X".
2) More importantly, could exiftool be improved to just be given a GPX file, and _only_ retag pictures if it finds a GPX waypoint with a smaller time offset from when the picture was taken, than time offset for the existing GPS point that's already in the exif header.

That way, exiftool would improve geotagging if possible, but never make it worse.

In the meantime, my script does this painstakenly and slowly, but does the job. I'll be delighted to retire it if its functionality can be moved directy inside exiftool.

Thanks,
Marc

Phil Harvey

Hi Marc,

Did you read the ExifTool Geotagging Options?  You can set GeoMaxIntSecs and GeoMaxExtSecs to limit the interpolation/extrapolation time.

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

marcmerlin

Thanks, I missed those, I'll try and change my code to use them instead.

Now, it's of course very wasteful to run exiftool once per picture with a different offset per picture.
Will there be a chance that exiftool can be improved to retag a full directory of files and only apply a GPS tag if it is better (delta-wise) than the current one already in the picture?

Phil Harvey

Thanks for the suggestion, but...

What you ask would require a fair bit of work as well as a new option for the exiftool application, and honestly I think it would just add to the confusion for most users.  If I opened this can of worms, then I should also add an option to compare the GPSDOP or number of satellites (which ExifTool currently doesn't write, but I would have to add this too), and update only if they are improved.

So I don't think that this option is something I'll be adding in the near future.

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

marcmerlin

Your application, your call :)

In the meantime, my code works, it's just very slow :)

Thanks for exiftool

Marc

marcmerlin

Phil, can I ask you another favour? I tried to follow https://exiftool.org/geotag.html#Examples
to call exiftool with a custom GeoMaxExtSecs value for each picture (as a quick reminder, I want exiftool to only replace the GPS geotagging if the gpx file has better data (smaller time offset) than the current offset between the GPS tag attached to the picture by my GPS camera, and the picture time).

How can I give a custom GeoMaxExtSecs value on the command line for each picture to process?

Separately, for geotagging, I have to manually feed the timezone offset between my camera's local timezone.
My computer is either PST or PDT, but I have my camera take all pictures on PDT because I want all my pictures to have a stable time offset, even if it's off by one hour compared to my local timezone 5 months a year.
This means I shouldn't have exiftool use my local timezone to do offset correction.

Given that, what argument should I give?
With gpsphoto, I was doing this:
$cmd="$gpsphoto --gpsfile $gpsfile --overwrite-geotagged --timeoffset ".($OFFSET*-3600)." --maxtimediff $gps_offset -i '$photo'";
(i.e I manually feed an offset of -7 * -3600).

How should I do this with exiftool (ignore system timezone, and feed a fixed offset of 7h):
-geotime<${DateTimeOriginal}+07:00' ?

Thanks,
Marc

Phil Harvey

Quote from: marcmerlin on October 09, 2012, 11:51:05 PM
How can I give a custom GeoMaxExtSecs value on the command line for each picture to process?

There is no equivalent command-line option.

QuoteHow should I do this with exiftool (ignore system timezone, and feed a fixed offset of 7h):
-geotime<${DateTimeOriginal}+07:00' ?

Yes.

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

marcmerlin

Quote from: Phil Harvey on October 10, 2012, 07:12:29 AM
Quote from: marcmerlin on October 09, 2012, 11:51:05 PM
How can I give a custom GeoMaxExtSecs value on the command line for each picture to process?

There is no equivalent command-line option.
- Phil

Right, so is there a way I can force a GeoMaxExtSecs value when I'm calling exiftool (with a per picture value), or should I keep using gpsphoto instead?
More generally, would you consider adding a way to specific config file values from the command line in a future?

Thanks,
Marc

Phil Harvey

Hi Marc,

You can specify the config file from the command line.  Would this help?  Then you only need one config file for each different GeoMaxExtSecs.

I don't plan on adding access to all of the API options via the command line (it's already too complicated).

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

marcmerlin

Having to create a config file to pass for each picture I'm trying to process is just making the whole thing too complicated now. Since I already have it working with gpsphoto just fine, I guess I'll just stick with that.

Thanks for the answers,
Marc