How to find the place where a photo was taken without third-party services
March 25, 2024
There are a huge number of online services that, using metadata (saved GPS information), can determine where a photo was taken and can show this place on the map.
I wrote a couple of these services myself:
Some people have concerns about how safe it is to send photos to third-party services. With an unstable and slow upload Internet, I find it annoying to have to wait for photos to upload.
Linux users have several tools available to view file metadata, including GPS information. I myself wrote several instructions for using them:
- 1. Programs for manipulating metainformation in images
- 2. How to understand, extract and convert geographic coordinates
- 3. How to spoof GPS and other metadata in photos
- 4. How to build motion tracks based on a group of photos
- GUI program to view and delete metadata in Linux
- How to view metadata in MS Word files. How to remove and edit Word metadata
- How to extract, delete and edit metadata in LibreOffice files
- How to recover metadata in processed photos
But, again, you need to understand these tools or coordinate transformations. They often show coordinates, but how can you use these coordinates to find a place on the map?
Is there an easy way to determine the place where a photo was taken without third-party services?
Yes, there is.
All you need to do is follow two very simple steps.
How to find out the place where a photo was taken without third-party services
1. Run the following command, specifying as PICTURE.jpg the path to the file with the photo for which you want to know the location:
exiftool -GPSLatitude -GPSLongitude -c '%+.6f' PICTURE.jpg
Example command:
exiftool -GPSLatitude -GPSLongitude -c '%+.6f' /home/mial/test/20240122_132926.jpg
The output will be something like the following:
GPS Latitude : +9.458688 GPS Longitude : +100.035445
2. Now you need to take the coordinates and write them down, separated by commas. Moreover, plus signs can be discarded, but minus signs cannot be discarded. Paste the resulting line into the following link instead of the word COORDINATES:
https://www.google.com/maps/place/COORDINATES
For example, in my case it turned out:
That's it – you can now open this link in your web browser! A map with the specified coordinates will open.
In addition, you can insert a string of coordinates (for example, in my case “+9.458688,+100.035445”) into the Google.Map search window.
And after pressing Enter, the place where the photo was taken will be shown.
An alternative way to find coordinates on a map
Another way to open a map with the desired coordinates is to use the following link:
https://www.google.com/maps/@COORDINATES,15z
For example:
The peculiarity of this method is that a marker with the exact location will not be shown on the map, and a search for the location by coordinates will not be performed – this may be useful to someone.
exiftool program not found
If the exiftool program (ExifTool) is not found on your system, then see the How to install ExifTool on Windows and Linux section.
A quick way to find out where a photo was taken without third-party services
Still too difficult? Well, you need to save the command somewhere. The link template also needs to be remembered somehow. Could it be even simpler?
It can.
Create a file called mial-geotagging.sh. Copy the following content into it:
#!/bin/bash coord=`exiftool -GPSLatitude -GPSLongitude -c '%+.6f' $1 | awk 'BEGIN{ORS=","} {print $4}'`; chromium "https://www.google.com/maps/place/${coord%,}"; ### In case you prefer other web browsers: #google-chrome-stable "https://www.google.com/maps/place/${coord%,}"; #firefox "https://www.google.com/maps/place/${coord%,}";
Pay attention to the lines:
chromium "https://www.google.com/maps/place/${coord%,}"; #google-chrome-stable "https://www.google.com/maps/place/${coord%,}"; #firefox "https://www.google.com/maps/place/${coord%,}";
These lines are responsible for choosing a web browser. By default, the map will open in Chromium. You can change the web browser to Chrome or Firefox – to do this, just uncomment the corresponding line and delete the line with chromium.
Run like this – instead of PICTURE.jpg, specify the path to the file with the photo:
bash mial-geotagging.sh PICTURE.jpg
Example:
bash mial-geotagging.sh /home/mial/test/20240122_132926.jpg
This will open a map in your web browser showing where the photo was taken.
If desired, you can make the file executable and copy it to the programs directory:
chmod +x mial-geotagging.sh sudo cp mial-geotagging.sh /usr/local/bin/
In this case, the launch can be done as follows:
mial-geotagging.sh PICTURE.jpg
For example:
mial-geotagging.sh /home/mial/test/20240122_132926.jpg
Conclusion
In my opinion, this is a very simple and safe way to extract coordinates from a photo and find them on a map.
If you wish, you can use maps other than Google.
And one more observation – the power of the command line is such that it can literally replace full-fledged services with 1-2 commands.
Related articles:
- How to recover metadata in processed photos (57.2%)
- Batch image processing in GIMP (51.4%)
- How to convert .webp images to GIMP (51.4%)
- Why does VirtualBox lose connection when changing MAC address (SOLVED) (50%)
- How to download YouTube videos on Windows and Linux (GUI without third party services) (50%)
- How to add the plugin to Double Commander to support all types of archives (RANDOM - 22.7%)