Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pygeocoder import Geocoder
- from datetime import datetime
- import time
- filename = 'addresses_'+datetime.now().strftime("%Y-%m-%d")
- f = open(filename,'w')
- f.close()
- curr_lat=44.815029
- curr_lon=-93.221052
- end_lat=44.775926
- end_lon=-93.105867
- sleep_cycle=0
- while curr_lon < end_lon or curr_lat > end_lat:
- results = Geocoder.reverse_geocode(curr_lat, curr_lon)
- print(results[0])
- f = open(filename,'a')
- f.write(str(results[0]) + " ; " + str(curr_lat) + "," + str(curr_lon) + "\n")
- f.close()
- if curr_lat > end_lat:
- curr_lat = curr_lat - .002
- else:
- curr_lat = 44.815029
- curr_lon = curr_lon + .003
- sleep_cycle = sleep_cycle + 1
- if sleep_cycle == 4:
- time.sleep(1)
- sleep_cycle = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement