-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps.py
54 lines (33 loc) · 1 KB
/
maps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import pandas as pd
import geocoder
#import webbrowser
import os
#from pyvirtualdisplay import Display
from selenium import webdriver
import folium
import time
# m = folium.Map(
# location=[45.5236, -122.6750],
# tiles='Stamen Toner',
# zoom_start=13,
# max_zoom=16
# )
m=folium.Map()
#give in the normal address we know
address = geocoder.osm('Canada')
#add marker to map
folium.Marker(address.latlng, popup='Statue Of Unity', tooltip='Click Me!').add_to(m)
fn = '../data/maps/map.html' #path to the html file
# can be defined to fit all points on the map
#m.fit_bounds([[min_lat, min_lon], [max_lat, max_lon]])
m.save(fn)
delay = 2
tmpurl = 'file://{path}/{mapfile}'.format(path=os.getcwd(),mapfile=fn)
m.save(fn)
your_browser_path= '/Applications/Firefox.app/Contents/MacOS'
driver = webdriver.Firefox()
driver.get(tmpurl)
#Give the map tiles some time to load
time.sleep(delay)
driver.save_screenshot(fn + ".png")
driver.close()