Using exiftool, if I have a file named foobar.jpeg and the shell variables lat="37.7708" and lon="-122.451".
What command do I use to set the EXIF metadata for that jpeg file such that its "geotag" / GPS metadata is set with those coordinates.
exiftool "-GPSLatitude=$lat" "-GPSLatitudeRef=$lat" "-GPSLongitude=$lon" "-GPSLongitudeRef=$lon" foobar.jpegBecause the GPS coordinates tags are unsigned, you need to make sure and assign the values to the relevant
GPSLatitudeRef/GPSLongitudeReftags as well, especially if the location is in the Western and/or Southern hemisphere. Even though these values would normally be set withN/SandE/W, exiftool well accept the raw values and figure out the proper Ref direction from that.