08 / Tools & Bots
Geo-Tag Image Viewer
A Python utility that turns the GPS data embedded in a photo into a map link.
- Python
- Pillow
- EXIF Metadata
- Google Maps
01 / The idea
Find the location hiding inside a photo.
I built Geo-Tag Image Viewer to see what a photo could tell me beyond what was visible in the frame. If the camera saved a GPS tag, the location is already in the file. I wanted a small Python tool that could read it and open that exact spot in Google Maps.
02 / The architecture
Read the image locally and send only the coordinates.
The tool runs from the command line and uses Pillow to read EXIF metadata from a local image. Python converts the embedded GPS data into a signed latitude and longitude, then passes that pair to Google Maps in a URL. The image itself stays local, and the script doesn't need a Maps API key.
03 / The challenge
Make sure a valid coordinate points to the right place.
EXIF stores latitude and longitude as degrees, minutes, and seconds, with the hemisphere recorded in a separate field. That means the conversion can produce a perfectly valid number and still point to the wrong place if I ignore that field. A west longitude with the wrong sign, for example, puts the marker on the other side of the prime meridian.
04 / The build
Convert GPS tags into a map link.
In findcat.py, I used Image.open() and
_getexif() to read the image, then pulled the GPS
fields from EXIF tag 34853. I wrote
dmsToDecimal() to convert each coordinate by adding
degrees, minutes divided by 60, and seconds divided by 3,600.
The script applies a negative sign for south or west coordinates
and prints the signed values in the terminal. Finally, it builds
a Google Maps URL and opens it with webbrowser.open().