Created
July 7, 2014 14:51
-
-
Save dijeferson/b7ac596c8467a9c6d3a0 to your computer and use it in GitHub Desktop.
Map photos using exif data
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
import photos | |
import webbrowser | |
query = 'safari-http://maps.apple.com/?q=%s,%s' | |
img = photos.pick_image(include_metadata=True) | |
meta = img[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', '') | |
print '%s, %s' % (latitude, longitude) | |
webbrowser.open(query % (latitude, longitude)) | |
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
Source: http://www.leancrew.com/all-this/2014/06/mapping-photos-with-pythonista-1-5/