Last active
March 21, 2019 16:04
-
-
Save omz/8838751 to your computer and use it in GitHub Desktop.
ShowLastPhotoMap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shows the location of the last photo in the canera roll in the Maps app. | |
# (thanks to @HyShai for pointing out that the latitude/longitude refs are necessary) | |
import photos | |
import webbrowser | |
meta = photos.get_metadata(-1) | |
gps = meta.get('{GPS}') | |
if gps: | |
latitude = str(gps.get('Latitude', 0.0)) + gps.get('LatitudeRef', '') | |
longitude =str(gps.get('Longitude', 0.0)) + gps.get('LongitudeRef', '') | |
maps_url = 'safari-http://maps.apple.com/?ll=%f,%f' % (latitude, longitude) | |
webbrowser.open(maps_url) | |
else: | |
print 'Last photo has no location metadata.' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment