How to geotag using data on command line?

Started by gwalschl, June 25, 2023, 06:07:50 AM

Previous topic - Next topic

gwalschl

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!

StarGeek

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).
"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

gwalschl

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.

Phil Harvey

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

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

gwalschl

Great, that answers my question. Thanks Phil!