The Map view in digiKam is handy for displaying photos on a map directly in the application. But what if you want to create a shareable and embeddable map with pins that mark all places where you took photos? A simple Bash script and the uMap service can help you with that.
By default, digiKam stores data (including geographic coordinates of all photos) in a dedicated SQLite database. So the first step is to extract the latitude and longitude coordinates from the database and save them in a CSV file. For this, you need to install the sqlite3 command-line tool. On Debian and Ubuntu, run the following command as root:
apt-get install sqlite3
Create then a text file and paste the code below into it:
sqlite3 -header -csv $1 "select latitudeNumber, longitudeNumber from ImagePositions;" > digikam_geo_export.csv
Save the file under the digikam_geo_export.sh name, and make the created script executable using the
chmod +x digikam_geo_export.sh command. Run the script in the terminal using the
./digikam_geo_export.sh command followed by the path to the digiKam database:
This generates the digikam_geo_export.csv file containing a list of latitude and longitude values of all photos in digiKam.
Next, create a new map in uMap and press Ctrl+I (or click the Import button in the floating palette) to open the Import data sidebar. Pick the generated digikam_geo_export.csv file and press the Import button. You should then see markers on the map.
uMap offers plenty of tools and settings for editing and configuring maps, so you can edit the created map to your heart’s content. Once you’re finished, save the map under the desired name.
You can share the created map either by sending its link or by embedding the map into a web page. To do the latter, press More, then click the Share button. Adjust settings in the Iframe export options section in the right sidebar, copy the generated embed code, and use it to embed the map.