GPS location from image to determine
By following script can read the GPS data from JPEG files.
Sunday, August 29, 2010
Pokemon Monopoly 2009
PICTURE WAS TAKEN AT ==================
LON: -86.88650000
LAT: 41.73200000 LON: -86.88650000
GOOGLE MAPS LOCATION ============== ==== http://maps.google.com/?q=41.73200000,-86.88650000 #!/usr/bin/python
import sys from PIL import Image # Florian Roth
# PictureDelphi 0.1
# August 2010 # PictureDelphi 0.1
from PIL.ExifTags import TAGS
def get_exif(fn):
ret = {}
i = Image.open(fn)
try:
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
if decoded == "GPSInfo":
ret["GPSInfo"] = value
lat_t = ret["GPSInfo"][1]
lon_t = ret["GPSInfo"][3]
lat = float(ret["GPSInfo"][2][0][0])
lat_add = float( ret["GPSInfo"][2][1][0] )
lat_add = lat_add/60/100
lat = lat+lat_add
if lat_t == "S":
lat *= -1;
lon = float(ret["GPSInfo"][4][0][0])
lon_add = float( ret["GPSInfo"][4][1][0] )
lon_add = lon_add/60/100
lon = lon+lon_add
if lon_t == "W":
lon *= -1;
print "PICTURE WAS TAKEN AT =================="
print "LON:% .8 f '% lon
print" LAT:% .8 f "% lat
" print GOOGLE MAPS LOCATION =================="
print "http://maps.google.com/?q = f% .8, .8% f"% (lat, lon);
except:
print "No GPS data present in the picture meta data"
foto = sys.argv [1]
get_exif (photo)
Subscribe to:
Posts (Atom)