How add a geotag with exiftool

Started by pferreira1961, July 12, 2022, 08:55:35 AM

Previous topic - Next topic

pferreira1961

Hello,
I'm really a beginner. I'm trying to add a localisation exiftool.exe. bur I'm affraid I did not understand everythin.

I send this command : exiftool.exe -geotag track.log 20220710_161931.JPG

I have these error messages:
Warning: Invalid track file 'track.log' in File:Geotag (ValueConvInv)
Warning: [minor] Adjusted MakerNotes base by 4112 - 20220710_161931.JPG
Warning: No writable tags set from 20220710_161931.JPG
    0 image files updated
    1 image files unchanged[/i][/i]

And I put the in the file track.log: 46.493490, 6.733802

Some one could help me with the formal of input file track.log ?

Many thanks for your help
Paulo

Phil Harvey

Hi Paulo,

It sounds like you want to do this:

exiftool -gpslatitude=46.493490 -gpslongitude=6.733802 -gpslatituderef=N -gpslongituderef=E 20220710_161931.JPG

The -geotag option reads many standard GPS log file formats, but tagging with a specific set of coordinates is done as above.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

See the Geotagging with ExifTool page for a list of supported GPS track log file formats.

You can't just drop numbers into a file and expect exiftool to figure out what you're doing.  And a time stamp in UTC is required, as well as making sure you known the time zone offset for the file.

If you don't have an actual track log and are planning on creating one by hand, then the ExifTool CSV Log File Format is what you'll want to create.  The easiest way to do that is open a spreadsheet program like Excel of LibreOffice, create headers as shown for the data, and then fill out that data.  Once done, you would export as a CSV file.

All that is for a track, but if you have a list of individual locations and know the files that match them, a track is not what you would use.  You would simply use exiftool to directly set the GPSLatitude/GPSLongitude/GPSLatitudeRef/GPSLongitudeRef tags.  A command line example would be
exiftool -GPSLatitude=40.6892 -GPSLongitude=-74.0445 file.jpg

This command uses a wildcard to set both the coordinate and reference tag.

If you already have a spreadsheet of coordinates, see this post for an example of how to modify it for use as a CSV file to directly load coordinates into files.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

pferreira1961

Hello Phil,
Many thanks for your quick answer. It works perfecly in command line  ;D ! Yeaah

I tried to add just a line with "-gpslatitude=46.493490 -gpslongitude=6.733802 -gpslatituderef=N -gpslongituderef=E" in track.log file but it doesn't work. Do you have an exemple of track.log file ?

I tried in command line with just "-gpslatitude=46.493490 -gpslongitude=6.733802" and it works too. is it mandatory "-gpslatituderef=N -gpslongituderef=E" options ?

As I have a old Canon I will be able to add Positions, this fantastic !
Paulo

StarGeek

Quote from: pferreira1961 on July 12, 2022, 12:18:13 PM
I tried to add just a line with "-gpslatitude=46.493490 -gpslongitude=6.733802 -gpslatituderef=N -gpslongituderef=E" in track.log file but it doesn't work. Do you have an exemple of track.log file ?

Geo tracks are much more complex than just a list of coordinates and are not something you would normally construct by hand.  For example, here's a sample of a GPX track
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Yamatabi logger for Android"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
<name><![CDATA[2013-01-28 15:25:04]]></name>
<trkseg>
<trkpt lat="33.139515" lon="-117.07865">
<ele>197</ele>
<time>2013-01-28T23:25:04.000Z</time>
</trkpt>
<trkpt lat="33.13947" lon="-117.07868">
<ele>206</ele>
<time>2013-01-28T23:25:34.000Z</time>
</trkpt>
<trkpt lat="33.139442" lon="-117.07868">
<ele>211</ele>
<time>2013-01-28T23:25:42.000Z</time>
</trkpt>
<snip>


QuoteI tried in command line with just "-gpslatitude=46.493490 -gpslongitude=6.733802" and it works too.

What Phil listed was for the command line only.

Quoteis it mandatory "-gpslatituderef=N -gpslongituderef=E" options ?

Pretty much yes, especially in the case of a negative (West/South) coordinate.

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).