Transfer exif gps info from one image to another
Take a look at ExifTool. It is a swiss army knife of Exif info manipulation, can do what you need, among many other things. It is Windows/Linux/Mac compatible command-line tool and a Perl module as well. Free and open source:
The "-tagsFromFile" Option
A special ExifTool option allows copying tags from one file to another. The command-line syntax for doing this is "-tagsFromFile SRCFILE". Any tags specified after this option on the command line are extracted from source file and written to the destination file. If no tags are specified, then all writable tags are copied. This option is very simple, yet very powerful. Depending on the formats of the source and destination files, some of tags read may not be valid in the destination file, in which case they aren't written.
The following command will change all files in current directory and its children (recursively), copying all GPS-related tags from the file SOURCE.JPG
:
exiftool −overwrite_original_in_place -r -tagsFromFile SOURCE.JPG -gps:all .
Another way to do this is to put the following into a script. First parameter passed should be the file to copy GPS coordinates from, and all other parameters are the target files to be updated:
#!/usr/bin/env bash
lon=$(exiftool -s3 -GPSLongitude "$1")
lat=$(exiftool -s3 -GPSLatitude "$1")
exiftool -GPSLongitude="$lon" -GPSLatitude="$lat" "${@:2}"