My wife always wanted to have one feature in our digital picture frame: To know where a particular photo was taken.
When you have thousands of photos on your Raspberry Pi digital picture frame, you may not immediately remember every single image taken over many years from your far-away travels.
This is where the GPS data comes in handy. Every modern smartphone will record the geo-coordinates of where a picture has been taken. DSLR photographers can use a GPS module on their camera, which can record this data. And alternatively, you can add the location manually in post-processing software like Adobe Lightroom.
The latest version of Pi3D PictureFrame 2021 comes with built-in reverse geocoding features which leave nothing to be desired.
Tested with: Raspberry Pi OS March 2021 version; Raspberry Pi 2, 3, and 4; Pi3D 2.43; PictureFrame 2021.03.20; 1080p and 4K displays.
How to extract the GPS data and turn it into places
Recently, Paddy, one of the authors of Pi3D PictureFrame, the undisputed best image viewer for Raspberry Pi-based digital picture frames, updated the software to allow a much simpler way to show the GPS location of a photo.
The GPS data that is stored in a JPG file provides the longitude and latitude data. But this needs to be translated into places or towns and countries; a process called “reverse geocoding”.
You wouldn’t want to see “latitude 48.864716 and longitude 2.349014” on your display but expect it to be translated as “Avenue des Champs-Elysées, Paris, France.”
Luckily, many free services provide these reverse geocoding services. And with Geopy, there is a perfect Python client to connect to several popular geocoding web services.
Paddy used Nominatim in his Pi3D image viewer script, a tool to search Open Street Map (OSM) data by name and address and to generate addresses of OSM points.
For example, this service tells us that latitude 48.864716 and longitude 2.349014 is Paris and not Los Angeles.
The advantage of using Nominatim is that you don’t need to create an account with any user name and password hassle. It works right out of the box with any random user name.
Here is how you install it.
Activating the Geo extension of Pi3D PictureFrame
picframe_data/config this is the part where the geo action is:
load_geoloc: False # get location information from open street map geo_key: "this_needs_to@be_changed" # you **MUST** change the geo_key to something unique to you locale: "en_US.utf8" # "locale -a" shows the installed locales which could used key_list: [ ["tourism","amenity","isolated_dwelling"], ["suburb","village"], ["city","county"], ["region","state","province"], ["country"]]
Change the first line to default=”True” to activate PictureFrame’s geo module.
Add a “unique key” in the next line in “default” to replace “this_needs_to@be_changed”. You can use just about any word. Nominatem doesn’t require you to create an account but uses a unique identifier to prevent users from abusing a free service. If lots of people use the same string, then Nominatem might start restricting the queries, so put a word here that is not commonplace.
I would recommend to use your email address because it is unique to you.
Next, check your locale. The “locale” is the language setting on your Raspberry Pi. In the context of geocoding, it specifies the output language for countries or regions – provided a translation is available. The chosen locale must be installed on your Raspberry Pi. How that works, see the chapter below.
locale: "en_US.utf8" # "locale -a" shows the installed locales which could used
Changing the language of the Geo Information
The language of the places (e.g., countries) is based on your Raspberry Pi default language that you have specified in
in the “Localisation” section. So, if you want to change the language, go in there and select additional language sets. I would recommend using the “UTF8” variant of a language to display any special characters in your language properly, e.g., German Umlaute or French accents.
At the end of the selection, you will be asked to select your default locale. This will be the language to show e.g., “Österreich” instead of “Austria” in the address data.
To change the date format, have a look here.
Triggering the display of the geolocation automatically when images change
As described in this article, the display of the file name, the Exif date, or the location is either invoked whenever a new image fades in or is manually triggered by using an MQTT command.
If you want to show either information automatically, look for this line in
show_text: "title caption name date folder location" # default="title caption name date folder location"
You can show any combination of information, but if you want the geodata then “location” must be included.
Triggering the display of the geolocation on demand
You may not want any information to be overlaid permanently on your photos all the time. However, it’s actually quite intriguing to turn it on permanently for a while. Especially for events, it may be interesting for your guests to see where you have been. (Ok, that is a bit of bragging but you get the idea!)
But to trigger the text overlay display manually, this is how it works:
Pi3D PictureFrame contains extensive remote control capabilities via MQTT, which you can find in the configuration.yaml file in the mqtt section.
MQTT may be somewhat confusing initially, but once you understand the basic logic, you will see that it is very straightforward to use and yet very powerful.
I have written articles explaining each mode in the links above.
The MQTT messages that you need to know for the display of an information bar are:
- name text on/off: homeassistant/switch/picframe_name_toggle/set, ON,OFF - date text on/off: homeassistant/switch/picframe_date_toggle/set, ON,OFF - location text on/off: homeassistant/switch/picframe_location_toggle/set, ON,OFF - directory text on/off: homeassistant/switch/picframe_directory_toggle/set, ON,OFF - title text on/off: homeassistant/switch/picframe_title_toggle/set, ON,OFF - caption text on/off: homeassistant/switch/picframe_caption_toggle/set, ON,OFF - all text off: homeassistant/switch/picframe_text_off/set, ON # yes that is confusing! - text refresh: homeassistant/switch/picframe_text_refresh/set, ON
I have covered the date and file name here. For location just send an MQTT with the topic “homeassistant/switch/picframe_location_toggle/set” and the payload “ON”.
You can toggle the display of the various items. To turn off the overlay of the location, just send another “homeassistant/switch/picframe_location_toggle/set” and payload “OFF”.
To turn off the information overlay completely, use “homeassistant/switch/picframe_text_off/set” and payload “ON”.
And “homeassistant/switch/picframe_text_refresh/set” with payload “ON” brings up the display again if you couldn’t read it before it disappeared.
By the way, even if you turn off the text overlay: When you pause, “PAUSED” is briefly displayed.
homeassistant/switch/picframe_paused/set with payload "ON" of "OFF"
When everything works, you will see something like
What is really nice with the Nomination Geo Service that in conjunction with Open Street Map, a lot of additional information will show up. Stuff that volunteers from all over the world have entered, which has a connection with the place where you took your photo. The example above is from a place in New Zealand where a scene from a movie was filmed. The language of the places and the date were set to German in the PictureFrame configuration.yaml file.
Please note: If no location is shown, then no valid Exif GPS data was found. If “no location found” is shown, it means that the Geoservice has no address, e.g. when you are flying or sailing across the ocean.
Please note: If the Exif data is not shown properly, then your Exif information may be corrupted. You can’t see this as the file opens and shows as normal. Out of 1,000 old photos, I had it in over 300 files, most of them older. What I did was to export them from Adobe Lightroom again, and then everything was clean. You can probably do the same with the photo software that you are using. You can verify the state of your Exif data with this simple script.
Please note: Reverse geocoding does not (yet) work with HEIC files.
I find the display of location data most interesting as it invokes even more memories in addition to seeing the photo. Yes, it does require that your photos are tagged, but as most photos today are taken with a smartphone, the location is already included.
Thank you very much, Paddy, for yet another tremendous Pi3D PictureFrame feature!
- Ask Siri about when a photo on your Raspberry Pi digital picture frame was taken
- How Victor built a WiFi photo frame with Pi3D which shows the location where the photo was taken (Geolocation)
- How to automatically control the display brightness of your Raspberry Pi photo frame
- How to fully integrate your Raspberry Pi digital picture frame into Home Assistant even showing the current image