Sotomajor.org.ua - development, photography and a lot of stuff: Geo-tagging photos from hikes by GPS log

This note describes how to put geolocation data into EXIF tags of your images (either JPEG or RAW) if your GPS device (Garmin in my example) was turned on when you did shots.

corner icon
Vienna 2010.08.07 Майдан 2010.07.14 Замки під Львовом. Занедбані і не дуже Zacharovana Desna 2010 2010.06.05 Винниченко Володимир - Між двох сил 2010.06.18 Lohika Company Day Lviv at night

Geo-tagging photos from hikes by GPS log

2010-07-18 17:20 // // Section:

During yet another hike I thought about necessaries to remember where each photo had been made, about extra-expensive cameras with embedded GPS chips and about cheap, but unhandy devices which allows to push the button and store the position when you do the shot and about my GPS device (Garmin GPSMap 60Csx) which can write log of journey (basically array of {coordinate, time, altitude} triples). "Damn, I can map time of photo taken from EXIF", - thought I, - "and find nearest logged coordinate in my track and voila - I can insert this information (altitude, longitude and latitude) into EXIF metadata of that image...

...When returned back from hike, of course I found ready solution which allows to do that :-) Here is perl script which allows to do everything I'd thougt about and even more: http://www.carto.net/projects/photoTools/gpsPhoto/

Usage:

I'm assuming you know how to retrieve .gpx file from GPS device and have python and exiftool installed in your system. If my assumptions are correct, here is what using of this script looks like:

bash:
mkotsur@n-racoon:~/Pictures/Photos/$ ~/scripts/gpsPhoto.pl --gpsfile ~/Documents/Untitled3tracks.gpx --overwrite-geotagged --maxtimediff 600 --timeoffset 3360  --dir ./
Found 1 total gps file name.
Parsing GPX file "/home/mkotsur/scripts/Untitled3tracks.gpx": 0 0 0 639 24 804 3 12 5 1 1716 1 1 1 3 1 242 2 2083 1 1258 points.
Processed 8606 coordinates.
Processing directory "./". 92 images.
Found 92 total image file names.
/home/mkotsur/Pictures/Photos//DSC_6303.NEF, 2010-07-14T14:34:26Z, timediff=1 to 15:30:27
Lat 49.1677669, Lon 23.0477725 - Bearing: 0 - Altitude: 558m
/home/mkotsur/Pictures/Photos//DSC_6390.NEF, 2010-07-16T13:11:07Z, timediff=1348
Could not find a coordinate.
..................................
/home/mkotsur/Pictures/Photos//DSC_6332.NEF, 2010-07-15T10:06:55Z, timediff=1 to 11:02:54
Lat 49.2849101, Lon 23.8787998 - Bearing: 0 - Altitude: 313m
Found coordinates for 77 images out of 92 images ... done.

Parameter names are quite descriptive, only timeoffset needs separate explanation. It's difference between time settings on your GPS device and camera.

After that you can check out the results:

bash:
mkotsur@n-racoon:~$ exiftool "/home/mkotsur/Pictures/Photos/DSC_6332.NEF" | grep GPS
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Time Stamp                  : 11:02:54
GPS Img Direction Ref           : True North
GPS Img Direction               : 0
GPS Map Datum                   : WGS-84
GPS Date Stamp                  : 2010:07:15
GPS Altitude                    : 313 m Above Sea Level
GPS Date/Time                   : 2010:07:15 11:02:54Z
GPS Latitude                    : 49 deg 17' 5.68" N
GPS Longitude                   : 23 deg 52'
43.68" E
GPS Position                    : 49 deg 17' 5.68"
N, 23 deg 52' 43.68" E

Same works with folder with NEF RAW files. I haven't tried are kept during JPEG conversion, but convinced that they are.

Outer references:

Also bunch of useful info can be found here. My first gallery geotagged this way is here.

Add a comment: