Import Batch GeoLoaction Exif data from CSV file

Started by mcq, December 01, 2022, 02:26:22 PM

Previous topic - Next topic

mcq

I have video frame grabs (jpg) from drone imagery.  I need to have the images geotagged with latitude, longitude, and elevation.  I have a csv file that has the image name, latitude, latitude, and elevation. The latitude and longitude are in decimal degrees. Is there a method of using the csv file to geo tag the images.  Each row of the csv file has the photo name, lat, long, and elevation.

Phil Harvey

I don't know how to do this in the GUI, but from the command line this is possible if you add the following header line at the top of the CSV:

SourceFile,GPSlatitude,GPSLongitude,GPSElevation
From the command line, this would be:

exiftool -csv=YOURCSVFILENAME *.jpg

But you should probably also write GPSLatitudeRef, GPSLongitudeRef and GPSElevationRef.  Assuming north/west and above sea level, it would be:

exiftool -csv=YOURCSVFILENAME -gpslatituderef=N -gpslongituderef=W -gpsaltituderef=above *.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Standard copy/paste, As per the stickied thread, the exiftoolGUI no longer has support from it's author.

"GPSElevation" should be GPSAltitude in Phil's post.

Alternatively, you could select the GPSlatitude,GPSLongitude,GPSAltitude columns in a spreadsheet program, copy/paste them as new columns, and then append "Ref" to the end.  The final CSV file would look like
Sourcefile,GPSlatitude,GPSLongitude,GPSAltitude,GPSlatitudeRef,GPSLongitudeRef,GPSAltitudeRef
/path/to/file.jpg,40.6892,-74.0445,10,40.6892,-74.0445,10

Exiftool is smart enough to figure out the N/S/E/W/Above/Below referencess directly from the numbered coordinate.

If the SourceFile only contains the filename, then you must run the command from the directory that contains the files.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mcq

Thank you both for your help with this.  After several trial and error attempts the following seemed to work:

exiftool -csv=73-EXIF-Simple.csv -gpslatituderef=N -gpslongituderef=W -gpsaltituderef=above -Make=Autel_Robotics -CameraModel=XT709 -FocalLength=4.7 *.jpg

The csv file contains the following (first few lines shown):

SourceFile,GPSlatitude,GPSLongitude,GPSAltitude,DateTimeOriginal
73_00_01.jpg,39.5574104928,-110.7651502383,1759,2022:11:21 12:00:01
73_00_02.jpg,39.5573632892,-110.7650991671,1759,2022:11:21 12:00:02
73_00_04.jpg,39.5573160856,-110.7650480959,1759,2022:11:21 12:00:04

I am not sure that the code added the camera model XT709 to the images exif data as it does not show up.  Also the focal length seems to be rounded to 5.

The bottom line is that the images have been accepted by the orthomosaic program I use.

Thank you both so much for your help.

Phil Harvey

You should be writing "Model" instead of "CameraModel".

The 4.7 should be there -- use the -n option when extracting to avoid the round-off.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).