-
Notifications
You must be signed in to change notification settings - Fork 0
/
commuter_location_coordinates
42 lines (32 loc) · 1.36 KB
/
commuter_location_coordinates
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
import pandas as pd
import folium
# Assuming you have a dataset with columns: 'Latitude', 'Longitude', 'Concentration'
df_map = pd.read_csv(' ')
# Create a folium map centered at the mean latitude and longitude
map_center = [df_map['LATITUDE'].mean(), df_map['LONGITUDE'].mean()]
chemical_map = folium.Map(location=map_center, zoom_start=10)
# Starting and ending coordinates
start_coord = [xxxx, xxxx]
end_coord = [xxxx, xxxx]
# Initialize a list to store coordinates for the trail
trail_coordinates = [start_coord]
# Add markers for each data point (chemical concentration) on the map
for index, row in df_map.iterrows():
coord = [row['LATITUDE'], row['LONGITUDE']]
# Add the coordinates to the trail
trail_coordinates.append(coord)
folium.CircleMarker(location=coord,
radius=5,
color='lightgreen',
fill=True,
fill_color='green',
fill_opacity=0.7,
popup=f"CONCENTRATION: {row['CONCENTRATION']}"
).add_to(chemical_map)
# Add the ending coordinates to the trail
trail_coordinates.append(end_coord)
# Add the trail to the map
folium.PolyLine(locations=trail_coordinates, color='darkblue', weight=2.5, opacity=1).add_to(chemical_map)
# Save or display the map
chemical_map.save('xxxx.html')
chemical_map