Geotagging in digiKam with a Lazy Bash Script

Sometimes, the easiest way to geotag photos in digiKam is to copy and paste geographical coordinates from an existing photo. I usually use Google Photos for that, as it conveniently displays geographical coordinates of the currently viewed photos in the information sidebar. There is only one problem with this technique: copying and pasting the geographical coordinates directly doesn't work. Continue reading
This is a companion discussion topic for the original entry at https://www.digikam.org/news/2016-12-09_geotagging_in_digikam_with_a_lazy_bash_script/

Hello @dmpop

Thanks for sharing the script.
I am wondering if that would be easy to convert these to the format that digiKam accepts:

50.8902-114.0161

I guess I should modify this part in order to make it work for me: -o | tr -d ’ ’

'#!/bin/bash latlon=“geo:”$(xclip -o | tr -d ’ ')
notify-send $latlon -i info
xclip -selection c

Changing xclip -o | tr -d ' ' to xclip -o | tr -d '-' should do the trick.

Best,
Dmitri

I could not figure out how to use tr and rewrote the script

#!/usr/bin/env bash
clipboard_original="$(xclip -o)"
latitude=${clipboard_original:0:8}
longitude=${clipboard_original:8:9}
clipboard_for_digikam_geo=""geo:""${latitude//+}"00000,"${longitude//+}"00000"
echo "$clipboard_for_digikam_geo" | xclip -selection c
exit

This one converts GPS coordinates copied from mediainfo / ffmpeg output to the format that digiKam Geolocation Editor accepts

2 Likes