Created
July 22, 2015 23:29
-
-
Save sanchi/f304e0c0d2739ba2f2bd to your computer and use it in GitHub Desktop.
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
from nominatim import Nominatim | |
import time | |
n = Nominatim() | |
outf = open('geos.txt', 'w') | |
with open('adrs.txt') as inputfile: | |
for line in inputfile: | |
print line | |
o = n.query("Berlin, "+line) | |
if len(o) > 0: | |
try: | |
lat = o[0]['lat'] | |
lon = o[0]['lon'] | |
print line + " -> " +lat+";"+lon | |
outf.write(lat+";"+lon+"\n") | |
time.sleep(1) | |
except: | |
print "?;?" | |
outf.write("?;?\n") | |
else: | |
print "?;?" | |
outf.write("?;?\n") | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment