Pythonista script to create satellite map of photos in iOS photo library

TLDR

If you want to create a satellite map showing where the photos in your photo library have been taken for a given date range this is for you.
Pythonista is an app to develop in Python on an iPad.
I have created a Pythonista Python script that asks you for a date range (start and end date of your trip) and then draws a satellite map showing where the photos have been taken like the following - it also generates a GPX-Track (Geodata) .gpx file and saves the satellite map as a .png image file in your “files” App and in the clipboard:

You can find the source code here

If you like this script you can pay me a coffee https://www.paypal.com/donate/?hosted_button_id=JBFJMV35LX5AY

Trip to teneriffa

New version

P.S. Based on a discussion in the Pythonista forum user @cvp and I created another version for the same use case that displays an interactive map with image thumbnails that you can zoom in to see for each photo where it was taken.

The source code is here in this gist

What is Pythonista?

Ever wanted to do some Python coding on the go on your iPad (Pro)?
Pythonista is a complete development environment for writing Python scripts on your iPad or iPhone.
The good thing is it does not come just with some standard Python modules (and their documentation) - In addition to the powerful standard library, Pythonista provides extensive support for interacting with native iOS features, like contacts, reminders, photos, location data, and more.

These native iOS features allow you to automate tasks in your iOS or iPadOS workflows and I used these to create the app.

Prerequisites to run the script

  • You have taken a set of photos using your iPhone or iPad while the location-feature was activated (your photos contain the geo-location in the meta-data/EXIF)
  • you know the calender date range (when your trip started and when it ended)
  • you have Pythonista app installed (at the time of writing it cost around 10 € or $)
  • you have some basic programming skills and feel confident to create and run a new Python script in the Pythonista IDE and download my Python script from the github gist web site into the new python script
  • the first time you run the script it asks you to grant permission to access your photo library - if you don’t trust Pythonista app or my script and don’t grant this permission it will not work.

What the script does

  • When you run the script you are prompted to specify the start and end calender date of your trip - these dialogs use the iOS integrated date pickers that you should be familiar with.
    • Just click on the pre-selected date to modify it and then press the “Select trip start date” text to confirm.
    • do the same for the “Select trip end date”
  • now the script is iterating all photos in your photo library and selecting those that
    1. have a geo-location in their meta-data
    2. have a creation date in the selected date interval (start_date <= creation date <= end_date)
  • then the hybrid satellite map is created for the bounds (min to max latitude and longitude) in your photo set and a path is drawn that overlays the map with the points your photos where taken connected in time sequence
  • the map is copied to the iOS clipboard
  • the map is saved as a .png file in the same folder where you stored your python script
  • the geo-location points are saved as a GPX track in the same folder where you stored your python script

What is a GPX track

GPX, or GPS Exchange Format, is an XML schema designed as a common GPS data format for software applications. It can be used to describe waypoints, tracks, and routes. It is an open format and can be used without the need to pay license fees. Location data (and optionally elevation, time, and other information) is stored in tags and can be interchanged between GPS devices and software. (Source: https://en.wikipedia.org/wiki/GPS_Exchange_Format)

I use GPX files on my garmin hiking devices as well as popular apps like komoot or outdooractive

Affiliations

I am in no way related to Pythonista, komoot, garmin or outdooractive and do not get any payment from them.

However if you like this script you can pay me a coffee https://www.paypal.com/donate/?hosted_button_id=JBFJMV35LX5AY