-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_page.py
84 lines (62 loc) · 2.27 KB
/
main_page.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import branca
import folium
import folium.plugins
import streamlit as st
from streamlit_folium import st_folium
import pandas as pd
import re
import numpy as np
import numpy as np
from datetime import datetime
import altair as alt
import json
import requests
import pandas as pd
import numpy as np
from folium.plugins import MarkerCluster
from folium.plugins import TimeSliderChoropleth
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import numpy as np
st.header('Visualization of California water testing Data over the last 100 years')
st.image('number_of_testing_stations_over_100_years.png')
st.header('Visualization of California water testing Data over the last 100 years')
st.image('Number of types of tests over the last 100 years.png')
map1903 = pd.read_csv(r"map1903")
st.subheader('Raw data')
st.write(map1903)
us_counties = (
"C:/Users/amcfa/Downloads/California_County_Boundaries.geojson"
)
us_counties
style_function = lambda x: {'fillColor': '#ffffff',
'color':'#000000',
'fillOpacity': 0.1,
'weight': 0.1}
highlight_function = lambda x: {'fillColor': '#000000',
'color':'#000000',
'fillOpacity': 0.50,
'weight': 0.1}
m = folium.Map(location=(38.5816,-121.4944),width=800, zoom_start=6,zoom_control= True ,dragging = True, scrollWheelZoom=True)
folium.GeoJson(us_counties).add_to(m)
NIL = folium.features.GeoJson(
us_counties,
style_function=style_function,
control=False,
highlight_function=highlight_function,
tooltip=folium.features.GeoJsonTooltip(
fields=['COUNTY_NAME'], # use fields from the json file
style=("background-color: white; color: #333333; font-family: arial; font-size: 12px; padding: 10px;")
)
)
marker_cluster = MarkerCluster(
name="county_name",
).add_to(m)
for row in map1903.itertuples():
#print(row)
folium.Marker(location=[row.latitude,row.longitude],popup=row.county_name).add_to(marker_cluster)
folium.LayerControl().add_to(m)
dicts = {"1903":m}
years = st.sidebar.selectbox("Please pick a year range",
("1903-1913","1914-1923"))
st_data = st_folium(m, width=725)