Our camera doesn't have a GPS. If we have a GPX track, we can tag all photos in a directory as follows:
- Ensure the GPX zulu + offset time matches the "Date/Time Original" field of the photos to be tagged.
exiftool -datetimeoriginal photo_to_be_tagged.jpg
-
Copy the GPX file into the directory with the photos to be tagged.
-
Run the following command from a terminal working in that same directory:
exiftool -geotag [GPX-FILENAME].gpx * -api GeoMaxExtSecs=300 -api GeoMaxIntSecs=300
Notes:
-geotag
is the exiftool option to perform geotagging.
[GPX-FILENAME].gpx
is the path and file name of the GPX track to be used.
*
is the path and file name of the photos to be tagged. This could also be a specific file name.
-api GeoMaxExtSecs=300
limits extrapolation to 5 minutes (300 seconds) beyond a GPX point. This prevents photos that are > 5 minutes outside of the time of the GPX track from being tagged.
-api GeoMaxIntSecs=300
limits interpolation to 5 minutes (300 seconds) between GPX points. This simply allows linear interpolation of position instead of tagging it to the closest point.
- Once happy, delete the preserved "original files" saved by exiftool for files that were modified.
rm *_original
If you just want to use coordinates from google maps, you can use the following. Note, if you just reuse the lat or long coordinate for the reference arguments, exiftool will figure it out:
exiftool *.JPG -gpslatitude=[gps lat from google maps] -gpslongitude=[gps long from google maps] -gpslatituderef=[gps lat from google maps] -gpslongituderef=[gps long from google maps]