Geotagged photos are increasingly the norm. Our smartphones, some new cameras, Eye-Fi cards (in wi-fi range), and other gadgets add the latitude and longitude to the “EXIF” metadata found in most photo files today. Having geotagged photos makes it easy to relocate some place you want to revisit, organize and view your photos by location, and when your photos falls into their hands, provides helpful information to any organization that might want to reconstruct your past movements. Fortunately, it is easy to add, remove, or change the geographic information found in EXIF data. These days, almost all photo management and online photo hosting services allow you to pinpoint a location for a photo via a map.
What if you march off into the wilderness with a “dumb” camera that lacks any GPS capabilities, and take dozens of pictures that you want geotagged? It is difficult and time consuming to go back and accurately locate the places you took your picture.
There may be another way. If, during your trip, you used a handheld GPS device, or used a GPS application on your smartphone to track your route, it is very likely you can export this data in the GPX format. With this, and a wonderful cross-platform command line tool called
exiftool which gives you control over all the EXIF data in your photos, you have what you need to automatically geotag all those photos using the following steps. I use a Mac so the instructions below may vary somewhat for Windows and Linux users out there.
1) The first time you do this you will need to download
exiftool from its homepage, and install it.
2) Export the GPS tracking information from your trip as a GPX file using your smartphone app or the software that came with your GPS device. In this example, we’ll save it to the Desktop (~/Desktop/ on OS X) as myroute.gpx.
3) Determine the exact difference (in hours, minutes, and seconds) in the clock time between your camera and your GPS device. For example, you can take a quick picture of your GPS device/app clock and compare the two times.
4) Put the photos you want to geotag into a folder. In this example, we’ll again put the folder on the desktop.
Geotagging your photos:
2) My GPS device usually has the correct time for whatever time zone I’m in, while my camera is notoriously wrong most of the time. Let us use
exiftool to update all the times on our photos. More importantly, this step ensures that we synch the time stamp on the photo with the data recorded on our GPS track.* Let us say my GPS device clock is 6 hours and 32 seconds ahead of my camera. To move all the photo time stamps ahead by that amount (the following should all be on one line):
exiftool -alldates+=06:00:32 ~/Desktop/myphotos
This command updates the time stamp on all the photos in the myphotos directory on the Desktop (~ means “my user home directory”), and leaves a copy of the originals with the suffix “_original” After confirming that this worked as you expected, you can delete or archive the originals before moving on. If your GPS device clock is behind your camera clock, I believe you can use “-=” instead of “+=”
3) Now all you have to do is geotag the photos with the following command (the following should all be on one line):
exiftool -geotag=myroute.gpx ~/Desktop/myphotos
As long as your GPS app or device was recording your position fairly frequently, then the location should be pretty accurate. Again
exiftool will save the originals with the suffix “_original” and you can of course just delete or archive these when you have confirmed that the geolocation data was added. How do we confirm this? Well, you can import the file into your favorite photo app or online service, which is probably easiest. Or you can use
exiftool itself. For example, to see all the EXIF metadata for
photo1.jpg in my photo directory I would enter:
In the data that scrolls past you should see information in the “GPS Position” field that looks like “35 deg 43′ 51.60″ N, 139 deg 26′ 6.36″ E.” If you copy and paste those coordinates into the search field of Google Maps, but delete the “deg ” in each coordinate you will find out where the picture was taken. In this case, in a family restaurant in a Tokyo suburb.
*An alternative approach is to skip this step and use “-geosync” to synchronize with GPS time on the fly. Read more about this and all the details about geotagging with
There are some
exiftool utilities and other geocoding utilities out there that may allow you to do this process of geotagging photos with a GPX file but without the need to do it on the command line. Has anyone tried them? Or found other handy ways to accurately geotag a large number of photos with separate GPS data?
Photo by K. M. Lawson, Creative Commons Attribution license.Return to Top