ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:03 AM

Title: Unsure with adding GPS-Data with a bash-script
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by linuxuser on 2007-04-12 11:14:22-07]

I read Post 4621 in the forum and GPS.html and I am unsure how to add GPS-Data with my bash-script. I use Google Map or Earth to find the position, where the picture was made. So I get something like "40degr. 25' 10" N, 3degr. 42' 20" W". The GPS-Tags-page says these tags are required: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, GPSAltitude and GPSAltitudeRef. I have no idea which data have to be used, I have 2 values only. Could you give me an example please? The 2nd question is, how do I update the GPS-Data _only_, if no data is present. I mean, if the picture contains GPS-Data already no update should be made. Of course I could check this with the bash too, but maybe it can be done faster with exiftool. Thanks!
Title: Re: Unsure with adding GPS-Data with a bash-script
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-12 12:34:23-07]

Hi,

The tricky part is splitting the position string into separate sections
so you can write them to the proper tags in the GPS information.
From your example, you must set the following tags:

Code:
-gpslatitude="40degr. 25' 10"
 -gpslatituderef=N
 -gpslongitude="3degr. 42' 20"
 -gpslongituderef=W

I think since you don't have elevation data it is best to leave out
gpsaltitude/gpsalituderef rather then set them to zero.

The script given in
post 4621
handled differently formatted lat/long information, and read it from
file, but essentially did the same thing.

From the command line, you could add a -if option to
only write files without GPS information (by testing the mandatory
GPSVersionID tag:

Code:
exiftool -if 'not $gpsversionID' ...

(windows users: note that the quoting above is for Linux, but you
need to use double quotes)

- Phil