import streamlit as st import leafmap.maplibregl as leafmap import ibis from ibis import _ con = ibis.duckdb.connect() ''' # LandVote Prototype ''' m = leafmap.Map(style="positron") with st.sidebar: if st.toggle("Protected Areas", True): style_choice = st.radio("Color by:", style_options) alpha = st.slider("transparency", 0.0, 1.0, 0.5) style = pad_style(style_options[style_choice], alpha) m.add_pmtiles(ca_pmtiles, style=style, visible=True, opacity=alpha, tooltip=True) select_column = { "GAP Status Code": "reGAP", "Management Agency": "cpad_MNG_AG_LEV", "Easement": "Easement", "Year": "Release_Year", "Public Access": "ACCESS_TYP"} column = select_column[style_choice] select_colors = { "Management Agency": manager["stops"], "Easement": easement["stops"], "Public Access": access["stops"], "Year": year["stops"], "GAP Status Code": gap["stops"]} colors = (ibis .memtable(select_colors[style_choice], columns = [column, "color"]) .to_pandas() ) main = st.container() with main: map_col, stats_col = st.columns([2,1]) with map_col: to_streamlit(m, height=700) df = summary_table(column, colors) total_percent = df.percent_protected.sum().round(1) with stats_col: with st.container(): f"{total_percent}% CA Covered" st.altair_chart(area_plot(df, column), use_container_width=True) st.divider() footer = st.container()