User Tools

Site Tools


projects:digikam:geolocation.txt

Geotagging in digiKam 2.0

Transcribed from Dmitri Popov's blog, 24 March 2011

Geolocation is not a new feature, but in digiKam 2.0 it has been thoroughly reworked to streamline the process of geotagging photos. The new Geolocation interface (Image → Geo-location) aggregates all geotagging tools in one place. The interface itself consists of three parts: the map pane contains a map and a toolbar with several navigation tools; below the map pane there is a list of selected photos; the sidebar on the right displays the currently active section.

 GeoLocation Tool

To geotag photos, you need to obtain the geographical coordinates of the place where the photos were taken, and the Geolocation interface offers several ways to do that. For starters, you can use the mouse to move around the map to locate the desired spot. By default, the Geolocation interface uses the OpenStreetMap service as its map source, but you can switch to Google Maps using the Maps Settings button below the map pane. If you know the full or partial address of the location, you can use the built-in search feature to find it on the map. Click on the Search tab, enter the address in the search field, hit the Search button, and you should see a list of matching results with corresponding pins on the map.

The easiest way to add geographical coordinates to the photos is to drag them from the list onto the desired spot on the map. Alternatively, you can assign the geographical coordinates of a specific search result to the photos. To do this, select the photos in the list, right-click on the desired search result, and pick the Move selected images to this position item from the context menu.

Once you've assigned the geographical coordinates to the photos, press the Apply button to write geotags to the photos.

 GeoLocation Tool

The Geolocation interface offers another nifty feature called Reverse Geocoding. This tool can retrieve human-readable locations such as city, street, country, etc. for photos based on their geographical coordinates. The obtained location names can be stored in photos as new tags, so you can easily search for photos taken in a specific country, city, or even street.

One way to put this feature to practical use is to create a dedicated Places tag, and then use reverse geocoding to add place-related sub-tags to it. To do this, create a new tag called Places (you can do this in the Tags sidebar). Select then the desired photos and choose Image → Geo-location. If the photos are not already geotagged, assign geographical coordinates to them. Switch then to the Reverse Geocoding section, right-click on the Places tag, and use the available context menu items to add the address elements to the tag (e.g., Country and City). Select all the photos in the list and press the Apply reverse geocoding button. You should see the country and city sub-tags (e.g., Germany and Berlin) under Places. Hit then the Apply button, and you are done. Now you can use the Filter sidebar to quickly locate photos taken in a specific country and city.

Chapter 8. Geolocation Editor

Gerhard Kulzer (gerhard at kulzer dot net)

The Kipi Geolocation plugin allows for adding and editing GPS coordinates of picture metadata. The geo-data is stored into the image (EXIF tags) and the location can be displayed in an external browser map.

Table of Contents

Geolocation

The correlator

Edit Coordinates

Commandline tagging

The Kipi plugin “Geolocation” provides the tools to localize pictures geographically in the common spherical coordinate system (used by GPS/Galileo). Altitude, latitude and longitude are used.

Note

The plugin only works for image formats that have EXIF metadata supported by libkexiv2.

Geolocation

The plugin has two methods to mark the pictures with coordinates:

  • Batch correlation of GPS tracking data with a series of images.
  • Semi-automatic coordinate attribution to single pictures.

The correlator

In order to correlate your images with geographic data you need to have a GPS tracking information available as a XML file in gpx format (gpsbabel and gpsman can download and convert tracking data from a GPS device for you).

Image → Geolocation → Correlator. This interface can correlate a previously selected number of pictures with registered GPS tracking information.

Example 8.1. The geo-correlation dialog based on EXIF date/time and tracking data (gpx format)

 GeoLocation Tool

Select the images you want to correlate in the application main view, then call the menu. The above dialog will show up. To indicate possible time/location correlation you have to load a track file with Load GPX File that contains GPS data taken at the same time and location as the pictures with your camera.

When the file is loaded, an automatic correlation is done showing the attributed coordinates in red. GPS track data is invariably recorded in GMT time, so you need to match the camera time with GMT, which can be done with Time Zone. Select the camera time zone here!

The Max. time gap setting specifies the limit within which GPS time and camera time shall be deemed coincident. The maximum value is 2000 seconds.

Tip

If you have no tracking data for pictures that were taken in the same place you can just manually edit a gpx file and apply it to those images. The 2000 second time gap will then correlate all pictures taken within 20 minutes.

The option Interpolate and Difference in min. can be used if there is no match of data. If you know that in reality there is a location match despite a larger time gap between camera and GPS, you can set this limit here and click on the Correlate button to interpolate.

Example 8.2. Correlation

 GeoLocation Tool

240 minutes is the maximum time difference that can be introduced here.

Edit Coordinates

Example 8.3. Semi-automatic attributing of coordinates through map interaction

 GeoLocation Tool

The coordinates can be set manually with this dialog. This comes in handy if there is a series of photos taken at the same location. Since the coordinates are memorized from one dialog call to another, it is as easy as clicking on OK to set the previous data to the current photo.

Otherwise the location can be found and fixed iteratively with the displayed map. Click on the region of interest, zoom in, adjust location by clicking again, and so on until sufficient accuracy is achieved. The altitude must always be entered manually. The map can be switched between map mode, satellite image or mixed mode.

Commandline tagging

Completely outside of the kipi-plugin context, the are ways to GPS tag images. Here is a shell script that uses exiftool to tag a batch of images.

#!/bin/sh
# exiftool wrapper script for easy commandline use. It treats regex files or whole directories.
#
#                        FMT                  Output
#                "%d deg %d' %.2f"\"    54 deg 59' 22.80"
#                "%d deg %.4f min"      54 deg 59.3800 min
#                "%.6f degrees"         54.989667 degrees
 
if [ -z $1 ]; then 
   echo "Usage: exiftool-gps-wrapper lat long [alt] file || dir (use signed floating coordinates)"
else
 
   if  [ -z "$4" ]; then  foo="$3"; alt=0
   else                   foo="$4"; alt=$3
   fi
 
   echo $foo
   if [ -e "$foo" ] ; then
        latR=$(echo "$1" | awk '{if ($1 < 0) print "S"; else print "N"}')
        lonR=$(echo "$2" | awk '{if ($1 < 0) print "W"; else print "E"}')
        lat=$(echo "$1" | awk '{val = $1; if ($1 < 0) sub(/-/, "", val); print val}') # absolute value
        lon=$(echo "$2" | awk '{val = $1; if ($1 < 0) sub(/-/, "", val); print val}') # absolute value
        # use the following syntax for easy googlian paste of ll=-1.23456,53.345345
        #lonR=$(echo "$2" | awk '{if ($2 < 0) print "W"; else print "E"}')
        echo $lat, $latR, $lon, $lonR, $3, $4, $foo
 
        function setgpsinfo ()
        {
            exiftool -c "%.6f" -GPSMapDatum="WGS-84" -GPSAltitude=$5 \
            -GPSLongitudeRef=$4 -GPSLongitude=$3 -GPSLatitudeRef=$2 -GPSLatitude=$1 "$6"
            exiftool -GPS:ALL "$6"
        }
 
        if [ -d "$foo" ] ; then
 
            for i in "$foo" ; do    # the selection of files treated depend on the passed regex
                echo "i= "$i
                setgpsinfo $lat $latR $lon $lonR $alt "$i"
            done
        else
            setgpsinfo $lat $latR $lon $lonR $alt "$foo"
        fi
   else echo "file or folder is wrong"
   fi
fi                 
projects/digikam/geolocation.txt.txt · Last modified: 2017/06/27 15:41 by 127.0.0.1