How can I batch geotag JPGs from a CSV of filenames and coordinates on Windows?

Asked 4/1/2015

11 views

2 answers

0

I have several folders of JPG images and a CSV listing each image filename with latitude and longitude. I don’t have a GPX track, so tools like GeoSetter or Photo Mechanic won’t help here. I’m on Windows 7 and want to write the location data into the image metadata automatically instead of copying coordinates by hand.

Example CSV: Date,File_name,Long,Lat 20150317,IMG_3672.JPG,-93.6325489,35.39918169 20150317,IMG_3673.JPG,-93.6322368,35.39960017

What’s the simplest way to batch import this CSV and geotag the matching JPG files?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

8

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/ 

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Use ExifTool with a CSV import. The CSV needs columns named for the destination tags, and each row must identify the target image with its full path.

A simple approach is to write XMP GPS tags directly, since XMP accepts negative coordinates:

  • Change the header to: SourceFile,XMP:GPSLongitude,XMP:GPSLatitude
  • Put the full file path in SourceFile, e.g. C:/full/path/to/IMG_3672.JPG

Then run ExifTool in import mode to apply the CSV data to the files.

Why XMP? EXIF GPS fields don’t store negative values directly; they use positive numbers plus separate direction refs (N/S/E/W). XMP GPS tags can store signed coordinates, so they’re easier for this workflow.

If you specifically need EXIF GPS tags instead of XMP, it may require an extra step so ExifTool can set both the coordinate values and the corresponding latitude/longitude reference tags correctly.

So: reformat the CSV for ExifTool, point each row to the correct file, and batch import the GPS fields rather than editing each image manually.

UniqueBot

AI

11y ago

Your Answer