|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import orgparse,os,re,sys,variables
|
|
|
|
|
import time
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
from geopy.geocoders import Nominatim
|
|
|
|
|
|
|
|
|
@ -65,7 +66,7 @@ if variables.trackplaces == True:
|
|
|
|
|
lookup = placename + ", " + variables.disambig[placename]
|
|
|
|
|
except:
|
|
|
|
|
lookup = placename
|
|
|
|
|
thedict = {"name":placename,"dates":[dates],"lat":geo.geocode(lookup).latitude,"long":geo.geocode(lookup).longitude}
|
|
|
|
|
thedict = {"name":placename,"dates":[dates],"lookup":lookup}
|
|
|
|
|
places.append(thedict)
|
|
|
|
|
else:
|
|
|
|
|
twodict = {"name":placename,"dates":[dates]}
|
|
|
|
@ -80,6 +81,23 @@ if variables.trackplaces == True:
|
|
|
|
|
|
|
|
|
|
theplaces = sorted(places,key=lambda d: d["name"])
|
|
|
|
|
|
|
|
|
|
for place in theplaces:
|
|
|
|
|
print("Fetching " + place["name"])
|
|
|
|
|
place["lat"] = None
|
|
|
|
|
while place["lat"] == None:
|
|
|
|
|
try:
|
|
|
|
|
place["lat"] = geo.geocode(place["lookup"]).latitude
|
|
|
|
|
except:
|
|
|
|
|
time.sleep(3)
|
|
|
|
|
continue
|
|
|
|
|
place["long"] = None
|
|
|
|
|
while place["long"] == None:
|
|
|
|
|
try:
|
|
|
|
|
place["long"] = geo.geocode(place["lookup"]).longitude
|
|
|
|
|
except:
|
|
|
|
|
time.sleep(3)
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
alllats = []
|
|
|
|
|
alllongs = []
|
|
|
|
|
for place in theplaces:
|
|
|
|
|