espm288 / app.py
jsupeyo's picture
Part1
c5fca7e
raw
history blame contribute delete
793 Bytes
import streamlit as st #import streamlit to build an app
import ibis #import ibis to run python package
from ibis import _
con = ibis.duckdb.connect()
st.title("Exploring Redlining in the USA") #website title
option = st.selectbox(
"Pick a city:",
("Oakland", "San Francisco", "Chicago"),
index = 1,
placeholder = "Select a city",
)
redlines = con.read_geo("/vsicurl/https://dsl.richmond.edu/panorama/redlining/static/mappinginequality.gpkg")
city = redlines.filter(_.city == option)
city_gdf = city.execute() # convert city into a gdf
st.write("You selected:", option)
import leafmap.maplibregl as leafmap
m = leafmap.Map(style = "voyager")
m.add_gdf(city_gdf)
m.add_gdf(city_gdf, "fill", paint = { "fill-color": ["get", "fill"], "fill-opacity": 0.8})
m.to_streamlit()