Spaces:
Sleeping
Sleeping
File size: 1,416 Bytes
1aa7583 1c76a96 1aa7583 1c76a96 1aa7583 e338567 1c76a96 1aa7583 1c76a96 1aa7583 1c76a96 656f25c d1dca6b 656f25c 1aa7583 656f25c 1aa7583 656f25c d1dca6b |
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 |
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()
|