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)

List of my other blog posts. My company.

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.