-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
61 lines (52 loc) · 1.74 KB
/
main.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
import pandas as pd
import json
import geopandas as gpd
from shapely import wkt
from shapely.geometry import Polygon, shape
from folium import Map, Marker, GeoJson
import branca.colormap as cm
import geojson
from geojson.feature import *
from geojson import Feature, FeatureCollection
import streamlit as st
from streamlit_keplergl import keplergl_static
from keplergl import KeplerGl
from streamlit_folium import folium_static
from snowflake.snowpark import Session
from snowflake.snowpark.functions import col
import logging
from streamlit_option_menu import option_menu
from apps import forecast, netcdf, precipitations # import your app modules here
st.set_page_config(page_title="Streamlit Geospatial", 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":forecast.app, "title": "Weather forecast", "icon": "brightness-high-fill"},
{"func":netcdf.app, "title": "NetCDF (Altitude)", "icon": "ladder"},
{"func":precipitations.app, "title": "Precipitations", "icon": "cloud-drizzle"}
]
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(
"Geo examples",
options=titles,
icons=icons,
menu_icon="collection",
default_index=default_index,
)
st.sidebar.title("About")
st.sidebar.info(
"""
This is a demo app to show the capabilities of Streamlit for geospatial.
"""
)
for app in apps:
if app["title"] == selected:
app["func"]()
break