5
\$\begingroup\$

I have a few folders of .JPG images that I need to geo-tag. I don't have a .GPX file or anything else that will let me use my usual tools (Geosetter or Photo Mechanic) to geotag the images, but I do have a CSV file of the image filenames and their lat/longs, like this:

Date,File_name,Long,Lat
20150317,IMG_3672.JPG,-93.6325489,35.39918169
20150317,IMG_3673.JPG,-93.6322368,35.39960017
20150317,IMG_3674.JPG,-93.6322159,35.39984365
20150317,IMG_3675.JPG,-93.6322203,35.39991498

I'm on Windows 7. Obviously, I could edit the EXIF metadata manually and copy and paste each set of coordinates into the appropriate EXIF tags, but I was hoping to find a way to do it automatically. I've found the Exiftool GUI, which has the ability to copy metadata from an XMP file to the appropriate JPG, but I don't know how to get my table into a set of XMP files in order to take advantage of that. I could also create a batch script to use Exiftool from the command line, which I can probably figure out on my own in due time but to someone who doesn't deal with EXIF data regularly, the sheer number of tags, command-line arguments and options available in Exiftool is a bit daunting.

\$\endgroup\$
0

1 Answer 1

8
\$\begingroup\$

ExifTool could do this, but the use of negative coordinates might make it a two step procedure depending upon what tags you want to use. XMP gps tags will take negative coordinates, but EXIF gps tags only accept positive numbers and need the directional reference tag to be accurate.

First off, there would have to be some changes to CSV. The first row would have to be "SourceFile,XMP:GPSLongitude,XMP:GPSLatitude". Date wouldn't be necessary, unless you need to change the date. The first column would have to be the full path to the source file. So, your csv file would have to be changed to something like

SourceFile,XMP:GPSLongitude,XMP:GPSLatitude
C:/full/path/to/IMG_3672.JPG,-93.6325489,35.39918169
C:/full/path/to/IMG_3673.JPG,-93.6322368,35.39960017
C:/full/path/to/IMG_3674.JPG,-93.6322159,35.39984365
C:/full/path/to/IMG_3675.JPG,-93.6322203,35.39991498

From there, the command would be as simple as

ExifTool -csv="/path/to/csvfile.csv" /directory/path/

That will load up the XMP gps tags. If you need the EXIF geo tags set as well, you could follow up with

ExifTool "-GPS:all<XMP-exif:all" "-GPS:GPSLongitudeRef<Composite:GPSLongitudeRef" "-GPS:GPSLatitudeRef<Composite:GPSLatitudeRef"  /directory/path/ 
\$\endgroup\$
3
  • 2
    \$\begingroup\$ This worked perfectly, thanks! The software I'm using apparently reads GPS data from the XMP tags so I didn't test the last step, copying the lat/longs from the XMP tags to the EXIF tags. \$\endgroup\$
    – Dan C
    Apr 2, 2015 at 19:44
  • \$\begingroup\$ the 2nd part that Dan didn't use also works perfectly. Thanks! \$\endgroup\$
    – DaveB
    Aug 13, 2016 at 20:25
  • \$\begingroup\$ I tried this method but no result. I think I am doing something wrong i.stack.imgur.com/y80Wy.png i.stack.imgur.com/hZ81V.png How exactly should I write the code? \$\endgroup\$
    – sevinc24
    Oct 19, 2022 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.