Moving away from Windows Photo Gallery Geotags

“Geotags” was a nice feature included in Windows Photo Gallery, and in response to a question I am writing this post.

First, a quick explainer on how geotags are saved in image files and used to work in Windows Photo Gallery (WPG) – As you may know, photo files such as JPG can store additional information called metadata. The best analogy is a printed picture with written information written on the back. There are multiple ways (formats) of writing this information known as EXIF, IPTC, XMP. Think of it as paper forms with fields (such as date, time, caption, locations) to fill in, which are added to a photo.

WindowsPhotoGallery_Geotag
A photo taken at the Seattle Central Library shown in Windows Photo Gallery. Placing the mouse over the geotag would reveal all the geotag information.

The fields which Windows Photo Gallery uses for geotags are: IPTC Core and Extension Location Fields (Location, City, State/Providence, Country) and EXIF GPS Latitude, GPS Longitude.

Here is the general logic behind Windows Photo Gallery’s Geotags in order:

1. If a photo already contains Location, City, State/Province and Country fields filled in, WPG would use the information it has to display as the Geotag. It would display the IPTC Extension fields first (if available) and the IPTC Core “legacy” fields (if available) second.

2. If a photo has GPS Latitude and Longitude, but no City, State/Province, or Country information then WPG would consult a Microsoft web service to determine the “Geotag” based on latitude and longitude, this process is called reverse geocoding. It will not however, write the “Geotag” information back to the file, unless it is edited manually.

3. If you, the user, edit a Geotag in WPG manually, it will be saved back to the file and that information becomes the “geotag”. However, here it is where it gets a bit tricky- There are multiple Location, City, State/Province, Country fields among the different metadata standards (IPTC and within XMP). WPG uses the “IPTC Extension- Location Created” fields to store the “Geotags” info within the photo.

IMG_3394
Windows Photo Gallery “Geotag” rename dialog box. When edited, the information is saved back to the file to the IPTC Extension “Location Created” fields.

Here is an example of the metadata from one of my photos. You will note multiple fields which may seem to contain redundant information, but the ones WPG would write to are just four which start with “Location Created”. These fields are detailed in the 2008 IPTC Extension Spec, further discussion on how this information is handled by certain applications can be found on the Metadata Working Group Spec.

Location Created City Seattle
Location Created Country Name United States
Location Created Province State Washington
Location Created Sublocation Seattle Central Library

Given that Microsoft decided to discontinue WPG last year, the service which determines the geotags is no longer working, so holdout users may find these fields empty or have trouble adding new geotags. Hence, exiftool, Lightroom or other photo management applications will only be able to show you geotag information if it was written within the file.

As a workaround, I rely on a freeware application called GeoSetter (which internally uses exiftool). Geosetter uses a service from Geonames.org to aid in finding location info as well it allows users to edit them manually. I exclusively have been using GeoSetter for some time, which unlike WPG it will always save the information back to the photo file. GeoSetter also allows one to edit the latitude and longitude info, which I was unable to do so in WPG.

However, as good as the Geosetter is, there is a slight catch – Geosetter by default does not read nor write to the newer 2008 IPTC Extension format which Windows Photo Gallery writes to. This is not just an issue with Geosetter, other photo management tools, like XnView MP, still primarily use the IPTC Core “legacy” Location fields, instead of the newer IPTC Extension Location fields. The IPTC Photo Metadata User Guide, explains the reasoning of creating the IPTC Extension fields. Luckily, Geosetter is versatile enough to provide a means for a workaround.

To make GeoSetter read any existing WPG Geotag – You will need to copy any saved “geotag” information from the IPTC Extension, to the equivalent IPTC Core fields using an exiftool command. In a previous post I described how to use exiftool for accessing Windows Photo Gallery. You will only need to run this step once on your photos from the command line. I advise you to make a backup copy of your files before executing it.

exiftool *.jpg -"Location<LocationCreatedSubLocation" -"City<LocationCreatedCity" -"Province-State<LocationCreatedProvinceState" -"Country<LocationCreatedCountryName" -r -overwrite_original
-r means that it will execute recursevly, so that all subfolder are included.
-overwrite_original means that exiftool will not create a backup of the file.

Again, this will only work on file which WPG saved the geotag information to the file, otherwise the fields will be empty.

To configure GeoSetter write back information to the newer format when an edit is made– In the GeoSetter application menu, go to File | Settings. In the Settings dialog, go to the “ExifTool” tab. Ensure that the “Use Additional Exiftool Commands after GeoSetter command” checkbox is enabled and add this text to the text field underneath:

-execute -"LocationCreatedSubLocation<Location" -"LocationCreatedCity<City" -"LocationCreatedProvinceState<Province-State" -"LocationCreatedCountryName<Country" -"LocationCreatedCountryCode<CountryCode"

I would leave this setting in GeoSetter, as it will make sure that location information is also saved to the IPTC 2008 Spec fields.

If you are still a die hard Windows Photo Gallery fan, you will find the geotag information populated with what you was entered by GeoSetter. While the reverse geocoding capability may be gone, you can still use WPG sort by GeoTag and Search functionality as before. Still, looking forward, I would avoid editing geotags in WPG and rely instead on GeoSetter as a replacement for this functionality in order to avoid the problems described.


References:

Related Posts:

Advertisements

​Crowd-sourced maps assist in Hurricane Maria relief efforts: How volunteers are helping put Puerto Rico on the map

As Hurricane Maria‘s winds and rain battered our home in San Juan, among the many thoughts that bounced in my head in those long hours was wondering about the people living in the mountainous regions of the island. The winding roads, heavy foliage, cliffs, bridges and terrain susceptible to landslides could make it the worst place to be in such a storm. Many small communities on those mountains would become isolated for days.

The storm left us without power, water and cellphone service. In the following days, I managed to connect to one of the few hotspots available and got an email indicating that The Humanitarian Open Streets Maps team was responding to the disaster per the request of the Red Cross. As a local OpenStreetsMap user, I new what that meant. Yet never imagined how it would take shape and how vital that information would become to the relief efforts.

OpenStreetMaps, or OSM as the name implies, is an open and publicly available geographical database which anybody can use and edit. Think of it as the Wikipedia for maps. Governments, Non-governmental organizations and companies such as AppleFoursquare and Yahoo use OSM. You may have seen OSM data in a map on your phone without even knowing it.
For some time I have tinkered as a contributor to OSM in my spare time. A small local group of volunteers have been able in getting some local government municipalities to contribute data to OSM. Most of it may be out of date so OSM volunteers review and even sometimes perform field work to ensure accuracy and quality. Local organizations such as Foundation for Puerto Rico have sponsored mapping activities to under-served communities. Initiatives like these have led to good PR road information in OSM. While larger cities may have good building descriptions, rural areas especially the mountain regions in Puerto Rico may have very little geographical information available.

When a major disaster strikes and a large scale response effort needs to be executed knowing where those building structures are located is essential. That’s when the Humanitarian OSM team can quickly turn the focus of mapping volunteers to analyse satellite imagery on a location in need. To my surprise, universities stateside sprang into action organizing Map-A-Thons for Puerto Rico. In these map-a-thons events, experienced OSM users recruit newbies and teach them the basics to put them to work in outlining buildings and drawing roads over satellite imagery. I even encouraged my brother who lives in NYC to attend one of the events. An avalanche of data ensued and its importance cannot be underestimated. When someone’s home is outlined on a map, it means something. It means that it exists, it is there and that a someone may live there.

I visited the Red Cross Operations Center in San Juan and witnessed something truly amazing. A flurry of activity with volunteers from around the world gathering to help our island. I had chance to talk with a Red Cross worker working the maps data and the folks responsible for prioritizing the relief efforts. In such a situation, it only beckons a human being to ask “How can I help?”, which I did. I was told the Red Cross was printing large format maps elsewhere and they needed that capability there. I quickly contacted some friends which where able to get them a large format printer to the ops center. As best as I could contacted the local OSM volunteers and GIS professionals, which could aide the Red Cross.

Red Cross volunteers in San Juan, PR hold up a map of Puerto Rico
Red Cross volunteers in San Juan, PR hold up a map of Puerto Rico

The Red Cross is providing disaster relief right now, as well as employing highly capable geographical information systems (GIS) tools with volunteers on the field to catalog which roads are accessible or obstructed. That obstruction could be a landslide, fallen trees or a collapsed bridge. The information is shared with FEMA and local agencies which in instances in coordination with the military determine the course of action for rendering aid.

VIDEO: Rutgers ‘map-a-thon’ aids relief efforts in Puerto Rico

Disaster relief volunteers from various organizations are being sent to every corner of the island, including hospitals, shelters, and elderly homes. Volunteers coming from afar, not familiar with Puerto Rico may need map data to navigate a post hurricane disaster zone where street signage may have been blown by the fierce winds.

So one can imagine a repeating story playing out in Puerto Rico. That of an elderly person living in the mountainous region of the island, who may be alone, without power, enduring sweltering heat, with no clean water and in need. Yet thanks to a someone in another part of the world who drew a simple outline of his house, a relief worker knows that there is a home there, how to get there and a knock on the door can happen.


You can help Puerto Rico and the Virgin Islands in various ways. Participating in a Mapathon, or donating to the Red Cross are some.

If you have a computer, an internet connection and some time you can assist in mapping Puerto Rico.

 

Accessing Windows Photo Gallery Metadata using Exiftool

With the demise of support to Windows Photo Gallery, it may be a good time to plan an app migration. I have seen various posts and comments on this, particularly after all the time and effort you may have spent tagging photos. The app which is meant to replace Windows Photo Gallery is the Windows Photos App. Unfortunately, the Windows Photos app does not support Captions, Descriptive Tags, People Tags nor GeoTags and to date I have not found any information which points that those features will be supported in the future.

So do not fret, as one of the pluses of using Windows Photo Gallery is that most of this information is stored into the image file and is accessible in Windows Explorer as well as any other apps which support photo metadata standards. Only in some instances this data is not stored to the file itself, such as “Flags” or if the image file in PNG or is set to “read-only”.

Understanding where the metadata is stored

Windows Photo Gallery stores much of this information as photo metadata using standards such as EXIF, IPTC IIM, and XMP (IPTC Core, IPTC Extension, Dublin Core and Microsoft Schemas) . I will not delve into the specifics of these standards but it is worth knowing to which fields the information is mapped to. In some occasions some information may be stored in multiple fields. For example, WPG captions information is stored in the XMP:Title, XMP:Description as well in other IPTC and EXIF fields.

The following table lists some of the photo information displayed in Windows Photo Gallery and the corresponding metadata fields from where the information is read and written to. I created this table from plain observation, if you find any other behavior let me know.

For reading and writing to these tags I highly recommend the excellent Exiftool command line utility. It may be daunting for some users to use the Windows Command line so I will try to be as specific as possible.Reading Windows Photo Gallery Metadata using Exiftool

Installing Exiftool

  1. (For Windows Users) Download the stand-alone Windows Executable from the Exiftool site.
  2. Unzip the exiftool(-k).exe and rename it exiftool.exe
  3. Copy the exiftool.exe to your c:\windows folder or to a folder contained in the PATH variable so it is accesible in any directory/folder.Detailed installation information can be found here.

Using Exiftool

  1. Open your command prompt in a folder containing photos either by running the Command Prompt shortcut in the Windows App Menu or by right mouse clicking on a folder while pressing the key  and selecting “Open Command Window here”.
  2. Confirm you have the current exiftool version by typing into the command prompt:exiftool -ver
  3. Pressing will return the version number.

Just typing the exiftool and the image file name will bring a host of information.

Exporting Windows Photo Gallery information to a File

This example will produce a file named “PhotoMeta.txt” which will contain a table with the filepath, filename, date and time photo was taken, camera maker, camera model, wpg caption, wpg descriptive tags, and wpg people tags contained in the current directory and its subdirectories.

Example:

exiftool -T -Directory -Filename -DateTimeOriginal -Make -Model  -xmp-dc:Title -xmp-dc:Description -xmp-dc:Subject -RegionPersonDisplayName -r *.jpg > PhotoMeta.txt

Using the “-T” option will output tab-delimited results. The “-r” option is used to include all the subdirectories contained within the specified “Pictures” directory. You can later open this table in Excel or import it to a database such a Microsoft Access for quick analysis.

Using IPTC location identifiers to link your photos to knowledge bases

In 2014, IPTC released an update to its photo metadata standard which supports the adding of “location identifiers” to photos. In simplest terms, a url can be added to the photo metadata which links the photo to geolocation identifiers (in the form of a URI) provided by services like WikiData, Foursquare, Facebook, DBpedia, Geonames, among others.

Wikidata_LocationIDWhy is this interesting?

As more cameras are GPS enabled it aides in establishing the “where” the photo was taken. A common example, is when you take a photo with your smartphone and share it on Instagram. During the upload process, Instagram provides a way to add the location where the photo was taken. Instagram uses the GPS data of the photo and looks up locations from the Facebook Places database (Instagram switched from using Foursquare to Facebook Places after being acquired by Facebook). After your photo is uploaded Instagram the photo is “linked” to that location. You can quickly see the photos you and other took in that same location.This IPTC standard simply allows you to save that association within the file.

Now, the benefits from this may not become entirely clear now but if such a “location identifier” is already included within the photo it could bring with it some benefits. From the previous example, it could ease the upload process since Instagram or any other photo service may be able to deduce quickly the location of a photo. I am not sure of any photo services which does this yet, but for example, Flickr for some time has implemented something similar using machine tags

In Flickr if you add a tag to a photo pointing to a foursquare location in the form of foursquare:venue=, Flickr recognizes the location and adds a map with the foursquare location.

A Smarter Search

Say you attend a basketball game in Madison Square Garden, and take some photos. Your smartphone recognizes where you are and “tags” the photo with the WikiData entry for “Madison Square Garden” (Wikidata Q186125). You upload a photo to an online photo sharing service, such as Google Photos and perform a search for “basketball game” or the team which played on that date. Given that the Wikidata identifier is associated with the type of venue and the type of games played there, a search engine with some “smarts” can deduce that a basketball game was played on the date you took that photo. Similarly, if Google Photo employs some of its image recognition on the photo it can have some additional information to make a better analysis of the image.

Also, a location may have different names and may be spelled differently in several languages. Linking a location to a Knowledge Base such as Wikidata allows a search engine to better understand the context of a photo.

So you see, the IPTC Location identifiers opens up some interesting scenarios and it is quite useful for photo archivists, librarians or a home user which may also be looking for ways to link photo to similar knowledge bases.

Saving OneDrive Photo Auto Tags to the file metadata

Last year Microsoft OneDrive introduced automatic tags to OneDrive. Like Flickr’s autotags, these employ some nifty image recognition algorithms to tag your photos.

03_iostags2

While not 100% accurate, they nevertheless help with finding photos. I am a big fan of tagging my photos using Windows Photo Gallery and was quick to check if these tags could be saved back to the file metadata, so that they can be used in the Windows desktop and other applications. I am not alone, seeing that this functionality has been requested in OneDrive’s Uservoice forum. Unfortunately, there is no direct way to save the auto tags back to the file but a workaround does exist, if you sync your OneDrive photos to your PC:

The temporary tag method:

1. On the OneDrive Photo Tags page select a tag which has been added automatically, for example “Sky” – All photos assigned that tag, “Sky” will be displayed.
2. Select all the photos displayed with that particular tag and click on “Edit Tag”.
3. Add the same tag with a “z” prepended, this will be a temporary tag. Example “zSky”.
4. Wait for OneDrive to sync the photos back to the PC. If you have a lot of photos with that tag and/or slow internet connection it may take a while.
5. On your PC, open Window Photo Gallery. Search for all photos with “zSky”.
6. Select all photos with “zSky” and add the tag “Sky”.
7. Remove “zSky” tag in Windows Photo Gallery

The result is that the “Sky” tag is written to the source files. The files will sync back up to OneDrive with “Sky” and the temporary tag “zSky” is removed.

At the moment Flickr does not expose their automatically added photos via the API. I hope they do, so that users can export these tags back to their files. The act of “confirming” these tags in the process should also help the image recognition algorithm “learn” how to better tag similar files, so it is a win win for the user and the service provider.

 

 

 

Geotag Photos with Foursquare / Swarm / Instagram and Facebook Check-Ins

Following up on my previous post on Geotagging Photos with Foursquare / Swarm Check-Ins, I stumbled upon an interesting scenario- How about a solution in which you could use your Foursquare/Swarm check ins, but the location information from Foursquare, Facebook, and Instagram.

I did some research and found possibly the best app for managing such data- the aptly named PinDrop. With Pindrop you can aggregate your Foursquare, Facebook, and Instagram locations as well as add your own. The locations, or pins you add on the app can be either shared or kept private. This is great for when travelling and if you want to keep track of the places you visited, but don’t necessarily wish to share it with your friends.

Now, for the frosting on the cake – you can export this information to a KML file which you can load into Geosetter. So far you can only export the data by visiting the website settings section. With the KML file you can more easily append the location place names to your photo’s metadata.

Now, combine this app with Geotag Photos Pro, which can record your location for easier location tagging, and you have a pretty interesting photo geotagging solution.

Happy geotagging!