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, as digiKam expects these values to be formatted as geo:lat,long. A simple Bash shell script solves the problem.
#!/bin/bash latlon="geo:"$(xclip -o | tr -d ' ') notify-send $latlon -i info xclip -selection c
The script uses the
tr tools to grab the contents of the clipboard (latitude and longitude values in this case) and strip the extraneous white space. The properly formatted string is then copied back into the clipboard ready to be inserted into digiKam.
Installing the script is a matter of running the following commands:
sudo cp geo /usr/local/bin/ sudo chown root:root /usr/local/bin/geo sudo chmod 755 /usr/local/bin/geo
Next time you need to format geographical coordinates, copy them, press Alt+F2, type geo, and press Enter. Switch then to digiKam, select the photo or photos you want to geotag, and choose Item →Edit Geolocation. In the geolocation editor, select the photos, right-click on the selection, and choose Paste coordinates. Press Apply, and you’re done.