Skip to content

This simple script extracts GPS coordinates from all images in a directory and places them on a map.

License

Notifications You must be signed in to change notification settings

ptanov/photos-to-map

Repository files navigation

photos-to-map

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: Google Earth + Komoot

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.

Running the script

Without Docker

  • exiftool is required (you can install it using sudo 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

With Docker

  • 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

Screenshots

  • Initial
  • Photos from the day
  • Exact photo
  • Initial
  • Google Earth + Komoot
  • Initial Selected image Exact photo

What if I don't have GPS coordinates

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.

Docker

Performance

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).

About

This simple script extracts GPS coordinates from all images in a directory and places them on a map.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published