Writing GPS coordinates a altitude data to images

Started by iLuna, May 04, 2014, 10:31:11 PM

Previous topic - Next topic

iLuna

Hello All,

I just downloaded the exiftool and have to get every image I have for a project (502 photos) with GPS coordinates and altitude. I have a file (.txt ) attached with the following information:

#Image name, Latitude, Longitude, Altitude, Roll, Pitch, Yaw

And I have a directory with my images:

C:\Users\m\Desktop\images

The "Image name" from the txt file match the images in my image directory. How do I get the information from the txt file to be recorded in the exif data like in batch processing?

Where should I start?

Thank you!

Phil Harvey

Here are the steps:

1) Install ExifTool for command-line use.

2) Change the first line of your .txt file to this:

SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSRoll,GPSPitch,GPSTrack

3) Put the .txt file in C:\Users\m\Desktop\images with your images.

4) Open a cmd.exe window and type "cd c:\Users\m\Desktop\images" (without the quotes), then press RETURN.

5) Type this command, then press RETURN in the cmd window:

exiftool -csv=position_data.txt -gpslatituderef=N -gpslongituderef=W -gpsaltituderef=above -gpstrackref=T .

(don't forget the " .")

All done.

This will write everything but the Roll and Pitch, which aren't standard GPS tags.  To write non-standard GPS Roll and Pitch, install the sample config file from the full distribution.

- 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 ($).

iLuna

Good morning!

It works great Phil, thank you very much!!!

I just had to add the "./" to the image name and my txt file is now like:
SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSRoll,GPSPitch,GPSTrack
./IMG_0592.JPG,8.912759,-83.524437,287.49,-2.92,15.21,52.97
./IMG_0593.JPG,8.913554,-83.523636,305.43,-2.8,15.12,50.62

I will check for the sample config file.

Thanks again!!

Phil Harvey

I'm glad you got it working, but I'm a bit puzzled.

Quote from: iLuna on May 05, 2014, 09:58:16 AM
I just had to add the "./" to the image name

Technically, this is correct because it is the exact source file path, but it should have worked without it.  It does on my system (Mac).  If it doesn't work for you with ExifTool 9.59 on Windows, then I have some work to do.

- 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 ($).

iLuna

 I tried without the "./" and it didn´t work. I´m using windows 7.

It sent me the following message:
No source file "./IMG_5092.JPG "in imported CSV database

Thanks for this tool!!!

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 ($).

Phil Harvey

Very odd:

> perl -e "use Cwd;my $f=Cwd::abs_path('a.jpg');print qq{$f\n}"
C:\cygwin\home\phil\source\exiftool_cvs\a.jpg
> perl -e "use Cwd;my $f=Cwd::abs_path('./a.jpg');print qq{$f\n}"
C:/cygwin/home/phil/source/exiftool_cvs/a.jpg


The Cwd::abs_path() function sometimes returns backslashes and sometimes forward slashes.  This is the reason why the file wasn't identified by its absolute path.  I will add a patch for this in ExifTool 9.60.

- 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 ($).

iLuna

Thank you Phil for making it easier.

Best regards,