Recently I took a lot of photos on my phone during fieldwork (survey for the NERC-ARF LiDAR and hyperspectral calibration flights) and wanted to extract the GPS coordinates from each photo so I could load them into QGIS using the add delimited text dialogue. The aim wasn’t to have precise locations for each photo (GPS positions for each of the points surveyed were recorded separately) but to give a quick idea of the locations we’d visited before the main GPS data were processed.
It code isn’t particularly tidy (despite my recent updates) but it basically pulls out the GPS location from the EXIF tags and writes this to a CSV file. To create a KMZ a thumbnail image is created and a corresponding KML file. Both the thumbnail and KML are then zipped together to generate the KMZ which can be opened in GoogleEarth.
To use the script to write a CSV file:
CreateJPEGKMZ.py --outcsv gps_points.csv input_jpeg_files
To also create KMZ files for each photo:
CreateJPEGKMZ.py --outcsv gps_points.csv \ --outkmz output_kmz_files input_jpeg_files
This was also a good lesson in the benefits of having scripts in version control and publicly available.