Get Wikimapia URL from EXIF

I don't know if it is useful or not, but I needed this. This scripts generates Wikimapia URLs from EXIFs in JPGs (in current directory):


Python 3. Run pip install exif before.

from exif import Image
import sys

def f (fname):
    with open(fname, 'rb') as image_file:
        my_image = Image(image_file)

    assert my_image.has_exif
    lat=my_image.gps_latitude[0] + my_image.gps_latitude[1]/60 + my_image.gps_latitude[2]/3600 
    lon=my_image.gps_longitude[0] + my_image.gps_longitude[1]/60 + my_image.gps_longitude[2]/3600

    #print (lat)
    #print (lon)
    print (fname)
    print (""+str(lat)+"&lon="+str(lon))

import glob
for fname in sorted(glob.glob("*.jpg")):
    f (fname)

Please drop me email about any bug(s) and suggestion(s): dennis(@)