ExifTool Forum

ExifTool => Newbies => Topic started by: iLuna on May 04, 2014, 10:31:11 PM

Title: Writing GPS coordinates a altitude data to images
Post by: iLuna on May 04, 2014, 10:31:11 PM
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!
Title: Re: Writing GPS coordinates a altitude data to images
Post by: Phil Harvey on May 05, 2014, 07:40:56 AM
Here are the steps:

1) Install ExifTool for command-line use (https://exiftool.org/install.html).

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 (https://exiftool.org/config.html) from the full distribution.

- Phil
Title: Re: Writing GPS coordinates a altitude data to images
Post by: iLuna on May 05, 2014, 09:58:16 AM
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!!
Title: Re: Writing GPS coordinates a altitude data to images
Post by: Phil Harvey on May 05, 2014, 10:05:50 AM
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
Title: Re: Writing GPS coordinates a altitude data to images
Post by: iLuna on May 05, 2014, 10:13:59 AM
 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!!!
Title: Re: Writing GPS coordinates a altitude data to images
Post by: Phil Harvey on May 05, 2014, 10:18:47 AM
OK, thanks.  I'll look into this.

- Phil
Title: Re: Writing GPS coordinates a altitude data to images
Post by: Phil Harvey on May 06, 2014, 08:58:56 AM
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
Title: Re: Writing GPS coordinates a altitude data to images
Post by: iLuna on May 06, 2014, 08:34:13 PM
Thank you Phil for making it easier.

Best regards,