import ibis from ibis import _ import streamlit as st st.set_page_config(layout="wide", page_title="TPL LandVote", page_icon=":globe:") ''' # LandVote Prototype ''' year = st.slider("Select a year", min_value=1988, max_value=2024, value=2022, step=2) #gdf = df.filter(_.year==year).execute() import leafmap.maplibregl as leafmap m = leafmap.Map(style="positron", center=(-100, 30), zoom=5) url = "https://huggingface.co/datasets/boettiger-lab/landvote/resolve/main/vote.pmtiles" #gdf = df.filter(_.year==1988).execute() #gdf.to_file("vote.geojson") outcome = [ 'match', ['get', 'Status'], "Pass", '#2E865F', "Fail", '#FF3300', '#ccc' ] paint = {"fill-extrusion-color": outcome, "fill-extrusion-opacity": 0.7, "fill-extrusion-height": ["*", ["get", "log_amount"], 5000], } style = { "layers": [ { "id": "votes", "source": "vote", "source-layer": "vote", "type": "fill-extrusion", "filter": [ "==", ["get", "year"], year, ], # only show buildings with height info "paint": paint }, ], } m.add_pmtiles( url, style=style, visible=True, opacity=1.0, tooltip=True, fit_bounds=True, ) #m.add_layer_control() m.to_streamlit()