This simple script extracts GPS coordinates from all images in a directory. Then it creates KML file with coordinates of all images. There is a link to open the image in Google Photos (if you have a copy of the images in Google Photos) - all photos from previous and next day, all photos from the day of the photo and exact photo are the three options. Then you can always open KML files in any GPS software, e.g. Google Earth (web/desktop/Android/iPhone), GpsPrune, etc.
When using Google Earth you can download different OpenStreet maps layers from Google Earth Map Overlays in order to have hike trails like this:
There is a docker image here: https://hub.docker.com/r/ptanov/photos-to-map. The source code is available here: https://github.com/ptanov/photos-to-map.
exiftool
is required (you can install it usingsudo apt install exiftool
)photos-to-map.sh "PATH-TO-IMAGES" > photos-to-map.kml
- photos in current folder
photos-to-map.sh > photos-to-map.kml
docker
is required (you can install it using docker install script)docker run --rm -v "PATH-TO-IMAGES":/data:ro ptanov/photos-to-map > photos-to-map.kml
- photos in current folder
docker run --rm -v "$(pwd)":/data:ro ptanov/photos-to-map > photos-to-map.kml
You can download your Location History (if enabled) from Google Takeout. Select only Google Location History
and use KML
format (instead of JSON
). Then you can create a copy of your photos (check the script copy-image-exif.sh
) and run this command targeting the COPY of the images (it will set approximately location to the images) exiftool -api GeoMaxIntSecs=18000 -api GeoMaxExtSecs=18000 -overwrite_original -geotag "Location History.kml" "PATH-TO-IMAGES/*"
(You can use 240 instead of 18000 to geotag only exact matches, e.g. when you have gpx file: exiftool -api GeoMaxIntSecs=240 -api GeoMaxExtSecs=240 -overwrite_original -geotag "*.gpx" "PATH-TO-IMAGES/*"
). For more information check exiftool.
- It is available in docker hub: https://hub.docker.com/r/ptanov/photos-to-map
- To build run
docker build . -t ptanov/photos-to-map
It tooks ~ 20 minutes to generate KML files for all my images (from 2005 until now - more than 800 folders) on my 10+ years old i7 laptop with HDD (no SSD).