- you have camera that doesn't have a built-in GPS chip
- you let Google harvest your location history
- you want to add GPS EXIF metadata to the files produced by your camera
make a separate copy of your photos/videos before using this script
This script is a single Python 3 file that doesn't have any Python dependencies (beside modules from the Python standard library) that you'll probably need to modify a little bit to make it fit your use case. Download this file, and run it using python geotag.py -h
.
You'll need to download your Location History from Google Takeout in JSON format.
You'll need to have exiftool
installed on your machine an in your PATH
. On macOS, you can install it with brew install exiftool
. The script uses exiftool
's JSON API to read/write EXIF to your files.
Unfortunately, the EXIF metadata don't specify the timezone where the picture was taken. Therefore, this script assumes that the datetime is in the UTC timezone.
You may want to update the script to change this behavior.