# 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.

KDE
Kipi

# Introduction

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 being used.

The plugin only works for image formats that have EXIF support 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 attribtuin to single pictures.

### The correlator

In order to correlate your images with geo data you need to have a GPS track available as a XML file in gpx format (gpsbabel and gpsman can do the download and conversion of track data from a GPS device for you).

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

#### The geo-correlation dialog based on EXIF date/time and track data (gpx format)

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 of course GPS data taken at the same time and location as the pictures with your photo 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.

If you have no track 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 seconds time gap will then correlate all pictures taken within two 3rds of an hour.

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.

#### Correlation

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

### Edit Coordinates

#### Semi-automatic attributing of coordinates through map interaction

The coordinates can be set manually with this dialog. This comes 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 onto 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 a litel script is given that uses the 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