-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaps.py
More file actions
78 lines (58 loc) · 2.51 KB
/
Copy pathmaps.py
File metadata and controls
78 lines (58 loc) · 2.51 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import folium
import pandas as pd
import numpy as np
import query
def plot_centers_maps(dataframe: pd.DataFrame):
dataframe = dataframe.reset_index(drop=True)
center_code = dataframe['cscode'][0]
center_name = dataframe['center'][0]
lat, lon = query.extract_lat_lon(center_code)
# max_lat, max_lon = 30.904099607254718, 80.4816491612127
# min_lat, min_lon = 26.1162751692073, 88.50605663476142
max_lat, max_lon = 31, 81
min_lat, min_lon = 27, 89
maps = folium.Map(location=(lat, lon), zoom_start=15,
max_lat=max_lat,
min_lat=min_lat,
max_lon=max_lon,
min_lon=min_lon
)
folium.Circle(location=(lat, lon), radius=50, fill_color='red', color='red', tooltip=center_name).add_to(maps)
for index, value in dataframe.iterrows():
scode = value['scode']
school_name = query.extract_school_details(scode)
school_lat, school_lon = query.extract_lat_lon(scode)
folium.Circle(location=(school_lat, school_lon),
radius=50,
color='blue',
fill_color='blue',
tooltip=school_name
).add_to(maps)
return maps
def plot_schools_maps(dataframe: pd.DataFrame):
dataframe = dataframe.reset_index(drop=True)
school_name = dataframe['school'].iloc[0]
school_code = query.get_schoolcode_by_name(school_name)
lat, lon = query.extract_lat_lon(school_code)
# max_lat, max_lon = 30.904099607254718, 80.4816491612127
# min_lat, min_lon = 26.1162751692073, 88.50605663476142
max_lat, max_lon = 31, 81
min_lat, min_lon = 27, 89
maps = folium.Map(location=(lat, lon), zoom_start=15,
max_lat=max_lat,
min_lat=min_lat,
max_lon=max_lon,
min_lon=min_lon
)
folium.Circle(location=(lat, lon), radius=50, fill_color='red', color='red', tooltip=school_name).add_to(maps)
for index, value in dataframe.iterrows():
scode = value['cscode']
center_name = query.extract_school_details(scode, "center")
school_lat, school_lon = query.extract_lat_lon(scode)
folium.Circle(location=(school_lat, school_lon),
radius=50,
color='blue',
fill_color='blue',
tooltip=center_name
).add_to(maps)
return maps