Embedding geotags in digital photos

X Marks the Spot

Article from Issue 193/2016

Add location data to your best digital images with digiKam and GPS Correlate.

Many image formats let you store the GPS coordinates for the image location as metadata. Storing location data with the image makes it easy to document where the image was taken. Some mapping tools will even let you plot the geotagged images on a map; you can click an icon on the map and see what the view was like from that location.

Most smartphones, which typically have built-in GPS capabilities, automatically add location data to captured images. But conventional digital cameras, even many premium cameras, don't have a way to sense and record GPS data.

The good news for users of these cameras is that Linux has some tools that will let you add location data to digital images after the pictures are taken. Most of these tools work with a GPX track. A GPX track is a log of coordinates from a recent hike or road trip. Turn on GPS tracking on your smartphone or GPS device, then start walking or riding. The device will record the data as a track that you can then display using a mapping tool.

This article describes a pair of tools for geotagging digital images: digiKam and GPS Correlate.

Converting Your Track

For many years, most GPS devices supported GPX format out of the box; however, some recent devices now use other formats. For instance, today's Garmin devices use the FIT (Flexible and Interoperable Data Transfer) format, which you will need to convert to GPX to use it with the geotagging tools described in this article. You can use a tool called GPSBabel [1] to convert virtually any track format.

The GPSBabel program supports almost all relevant formats and lets you convert relatively easily. To convert, for example, a FIT file, use the garmin_fit option as a parameter for the GPSBabel program (Listing 1).

Listing 1

Converting a FIT


If you favor a GUI, the GPSBabel tool does have a graphical interface named Gebabbel, but my impression is that Gebabbel doesn't really make using GPSBabel much easier, because it also ultimately requires input at the command line.

Once you have the GPX tracks for the tour, you can start tagging. The coordinates of each track must exist in its own file. You can collect all your tracks in a directory and specify all the files to correlate. The programs ignore tracks that you recorded on days other than the days the images were processed.


If you already use the open source digiKam photo tool [2] to manage images, you might already be familiar with a feature called Edit Coordinates, or something similar – the name has changed several times in recent versions. You will find it under Image | Geolocation | Edit Coordinates.

When you select Edit Coordinates, digiKam displays a wizard to let you associate your photos with locations on the GPX track. You can either position the images on the map with your mouse to associate the image with the corresponding coordinates, or you can use using the GPS Correlator tab on the right margin (Figure 1).

Figure 1: Using digiKam, users can transfer coordinates from the GPX tracks to images.

If you load multiple GPS tracks at the same time, digiKam shows them in different colors to distinguish between tracks.

The Manual option and Fine offset (mm:ss) below Camera time zone help you synchronize the clocks in the camera and your GPS device (Figure 2). Interpolate tells the application to calculate any missing timestamps automatically. The synchronization feature could cause problems if you connect multiple tracks over a period of time: synchronization is only intended to plug minor gaps in the tracks, such as when woods or buildings prevented reception.

Figure 2: If necessary, adjust the navigation device's time with the time the camera stored in the Exif tags.

Pressing Correlate accepts the data in the images. To check whether the correlation was successful, check randomly selected images to see whether they were positioned correctly on the map. If you have defined an offset, check that the sign is correct. If you receive an error message, look for non-correlated images.

The easiest way of doing this is to open the images as a list and then sort them by latitude. Images that the application did not map are at the top of the list. Try to find out why they were not matched: Missing a track? Faulty Exif data? If you want to position the images manually, now is the right time to do it.

You can stop the action by pressing the Apply button, which tells the program to write the data to the images. If you want to write data to RAW files, you will need to enable the option for writing metadata in the digiKam configuration. Choose the Settings menu below Configure digiKam, select the Metadata tab, and enable the option labeled If possible, write metadata to raw files (experimental). Alternatively, you could add the metadata to XMP sidecar files.

GPS Correlate

Another option for geotagging digital images is GPS Correlate [3]. GPS Correlate consists of two components: a program for the command line (gpscorrelate) and a GUI (Figure 3). Like digiKam, GPS Correlate can work with RAW files as well as JPEGs.

Figure 3: GPS Correlate's graphical interface provides a simple alternative to the digiKam wizard for geotagging photos.

The GPS Correlate interface is simpler than digiKam's wizard. The tool displays the data very clearly, which really helps if you have to manage many images. However, some stumbling blocks spoil the overall good impression: If the timestamps were not recorded precisely, the software is significantly less capable of automatically correlating images than the digiKam wizard. Also, the software does not let you automatically sort the non-mapped images so that entries appear within a block in the list. Finally, a preview feature, which is always useful for troubleshooting, is missing.

You manage the command-line variant through a series of options. Table 1 summarizes the most important. By default, the tool changes the image files it processes, even RAW files, without providing feedback. The Don't write option in the GUI and command-line parameter n prevent this automatic write option.

Table 1

GPS Correlate Options



-g <datafile>

Specify GPX track used

-z <+/-HH[:MM]>

Time offset


Disable (linear) interpolation


Stop writing to the file

-m <seconds>

Maximum time for points outside of the tracks


Show stored geographic information from the files


Output in machine-readable format


Remove geo-information from files


Interpolate between the track segments


Do not change modification time of file on writing


Repair broken time stamps

-O <seconds>

Offset time for images

-v, --verbose

Output more detail in messages

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • digiKam 5

    The freshly released digiKam 5 boasts a number of new features, brings many improvements, and ditches some legacy ballast.

  • DigiKam 1.0.0 First Beta

    Gilles Caulier has announced the first beta version of DigiKam with the magic number 1.0.0. Downloads are provided.

  • Prune

    Have more fun with your GPS data with this easy-to-use Java-based tool.

  • Quick-and-Dirty Geotagging with a Bash Script
  • ExifTool and jExifToolGUI

    ExifTool lets you modify and analyze metadata in multimedia files from the command line, but its comprehensive feature set results in a lengthy learning curve. Luckily, jExiftoolGUI offers an intuitive interface that makes using ExifTool easier, even for less experienced users.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More