generated from giswqs/streamlit-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
split_map.py
48 lines (37 loc) · 1.16 KB
/
split_map.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
import streamlit as st
from streamlit_option_menu import option_menu
# import your app modules here
from apps import split, scotland
st.set_page_config(page_title="Split-panel Map", layout="wide")
# A dictionary of apps in the format of {"App title": "App icon"}
# More icons can be found here: https://icons.getbootstrap.com
apps = [
{"func":split.app, "title": "Home", "icon": "house"},
{"func":scotland.app, "title": "Scotland", "icon": "globe"},
]
titles = [app["title"] for app in apps]
icons = [app["icon"] for app in apps]
params = st.experimental_get_query_params()
if "page" in params:
default_index = int(titles.index(params["page"][0].lower()))
else:
default_index = 0
with st.sidebar:
selected = option_menu(
"Main Menu",
options=titles,
icons=icons,
menu_icon="cast",
default_index=default_index,
)
st.sidebar.title("About")
st.sidebar.info(
"""
Web App URL: <https://gishub.org/split-map>
Contact Qiusheng Wu (qwu18@utk.edu) if you have any questions or comments.
"""
)
for app in apps:
if app["title"] == selected:
app["func"]()
break