ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: gwalschl on June 25, 2023, 06:07:50 AM

Title: How to geotag using data on command line?
Post by: gwalschl on June 25, 2023, 06:07:50 AM
The documentation on geotagging says "You may write either a GPS log file name or the GPS log data as the value for Geotag. If the value contains a newline or a null byte it is assumed to be data, otherwise it is taken as a file name".

For my application, I would like to read the text contents of individual GPX files, save each file's text into individual records keyed by date in a database and then subsequently pass the text to ExifTool for geotagging when I geotag photos.

First question - What form must the data be when passed in on command line? Can I just pass the entire contents of the text extracted from the GPX file as-is without any changes?

Second question - Is there any limitation as to the size of the data that can be passed in?

Thanks!
Title: Re: How to geotag using data on command line?
Post by: StarGeek on June 25, 2023, 12:36:26 PM
No idea on the first question, I've never tried it to see how that works.

On the second question, the maximum length would be determined by the command line. For Windows, that's about 8,000 characters.  For Mac/Linux, it would be around 32K on a 32 bit system and 209K on a 64 bit (according to my quick google search).
Title: Re: How to geotag using data on command line?
Post by: gwalschl on June 26, 2023, 07:06:12 AM
Thanks StarGeek. I'll wait a bit and see if anyone else (maybe Phil Harvey) can elaborate on what ExifTool expects on command line. If no responses, then I'll just have to determine it empirically.

On the second question, I now realize I should have been more clear. I was intending to inquire about the limitations from ExifTool's perspective as opposed to the more general OS command line limitations, but thanks for the information.

Your response was much appreciated.
Title: Re: How to geotag using data on command line?
Post by: Phil Harvey on June 26, 2023, 01:11:10 PM
Quote from: gwalschl on June 25, 2023, 06:07:50 AMFirst question - What form must the data be when passed in on command line? Can I just pass the entire contents of the text extracted from the GPX file as-is without any changes?

In the same form as any track log readable by ExifTool (ie. GPX)  So, yes.

A command to illustrate this (on Linux/MacOS) by piping the data:

cat file.gpx | exiftool -geotag - IMAGEFILE

QuoteSecond question - Is there any limitation as to the size of the data that can be passed in?

There shouldn't be a limit on the size of a piped file, but your system may have command-line-length limitations if you try to put the data directly on the command line.  ExifTool imposes no limit itself.

- Phil

Title: Re: How to geotag using data on command line?
Post by: gwalschl on June 27, 2023, 03:27:57 AM
Great, that answers my question. Thanks Phil!