Introduction: Modify Windows to Show Where a Photo Was Taken
Introduction
Have you ever looked through your travel photos and started wondering just where you took them? What was the name of that little town you stopped in five years ago, the one where you had the most amazing coffee? Once you've modified Windows using this guide, you'll be able to call up a map showing where you took your photos - with just a couple of clicks.
Caveats
This guide requires "some assembly" - it will help if you have a basic understanding of what the Windows Registry does, and how to make a simple batch (.BAT) file. If you don't, you can still try to follow the steps, but it may be harder to figure out what's wrong if you make a mistake.
This guide is meant for Windows 10. If you have an older version of Windows, the initial steps will still work, but you may need to do something different at the "Modifying the Windows Registry" stage. Unfortunately, as I don't have any machines with an older Windows version, I can't help you there; you may have to look elsewhere for help with that.
This hack will only work on photos taken with a GPS-enabled cellphone or camera. Most modern smartphones will automatically save the location data to each photo they take - if they happen to have location data available. It will not work in the following cases:
- The photo was taken in an area where the phone or camera couldn't determine its own location, such as an indoor area.
- The photo was taken while the phone's location services were switched off, such as in "airplane mode".
- The photo's location data has been removed. For instance, when you upload a copy of a photo to Facebook, the location data of the uploaded copy is usually removed.
Step 1: Assembling the Files
To start, you will need Phil Harvey's ExifTool program. This can be found at Mr. Harvey's personal page on the Queen's University website:
http://owl.phy.queensu.ca/~phil/exiftool/
Download the Windows executable package and extract it to the folder C:\EXIFTool . Rename the EXE file name to "exiftool.exe".
I've attached a batch file named "Exif2GoogleMaps.bat" - download it to the same folder. If you're curious or suspicious, the content of the file is as follows:
@echo off
for /f "tokens=*" %%i in ('exiftool -q -q -gpslatitude -gpslongitude -T -c "%%d°%%d'%%.2f" "%~1"') do set COORDS=%%i if "x%COORDS:-=%"=="x%COORDS%" ( explorer "http://www.google.com/maps/place/%COORDS%" ) else ( ECHO That picture does not have GPS coordinates attached! pause )
As you can see, the file's function is pretty straightforward. It uses ExifTool to read the GPS coordinates off the image, formatting them in a way that Google Maps can understand. If ExifTool successfully finds the coordinates, the batch file opens a webpage in the computer's default browser, pointing to the target coordinates in Google Maps. Otherwise, it will leave a message telling you that the image does not have GPS coordinates.
Attachments
Step 2: Modifying the Windows Registry
Next, we need to set up the Windows Registry so that right-clicking on a JPG file will give us the option to open it using the batch file we just made.
- Open the Registry Editor. (Click the Start button, then type "regedit" and press Enter.)
- In Registry Editor, go to the following key: HKEY_CLASSES_ROOT \ jpegfile \ shell
- Right-click on the "shell" key, and choose New / Key. This will cause a new key to appear within "shell", and prompt you for a name. Name the new key "Show location in Google Maps".
- Right-click on the "Show location in Google Maps" key, and again choose New/Key. Name this key "command".
- Click on the "command" key to open it. Right-click on the "(Default)" value in the right-side pane, and choose "Modify". Registry Editor will ask you for value data; enter the following:
C:\EXIFTool\Exif2GoogleMaps "%1"
When you're done, the Windows Registry should look something like the above screenshot, and the modifications should be complete.
Step 3: Using the Hack
Using this hack is pretty simple. Right-click on any JPG photo, and the option "Show Location in Google Maps" should be on the right-click menu. Choose it, and if the photo has location data, your web browser will pop up a new tab with the photo's location showing in Google Maps.
Step 4: Troubleshooting
I right-clicked on a JPG file, but the option “Show location in Google Maps” didn’t appear.
Most likely your Windows registry is set up to override the jpegfile key with something else. There are two possibilities, both of which you can fix using Registry Editor:
- You might have a user-level override. To fix this, go to HKEY_CURRENT_USER\Software\Classes. If you see a “jpegfile” key in that folder, then that key is probably overriding the root key. Simply follow the same procedure that you did for HKEY_CLASSES_ROOT\jpegfile, but do it for HKEY_CURRENT_USER\Software\Classes\jpegfile instead.
- You might have installed a third-party image viewer that overrides the jpegfile class. In this case, you will need to find the appropriate key in HKEY_CLASSES_ROOT or HKEY_CURRENT_USER\Software\Classes; in my case it was HKEY_CLASSES_ROOT\XnView.jpg. Again, once you have found the right key, the procedure is nearly identical.
When I choose "Open Location in Google Maps", the computer opens Google Maps in a browser I don't like (usually Microsoft Edge).
The script will always use your computer's default browser setting. To fix this, set your default browser to something you actually like.
When I choose "Open Location in Google Maps", the computer gives an error such as "Searching for Exif2GoogleMaps.bat". OR: When I choose "Open Location in Google Maps", I see a black window with an error such as "File not found: exiftool.exe".
The files aren't in the correct folder. Please check Step 1 again, and ensure that exiftool.exe and Exif2GoogleMaps.bat are both in C:\EXIFTool.
When I choose "Open Location in Google Maps", the computer opens Google Maps, but it's definitely showing the wrong location (e.g. in the middle of the sea).
It seems that ExifTool's output could not be read correctly by Google Maps. This may be because of a peculiarity in your Windows language settings, or it may be because of a problem with the batch file. Try downloading and using the batch file from Step 1 in place of whatever you have now. If that doesn't work, I'm sorry, but I might not be able to help you. Contact me anyway and I'll see what I can do.