Spaces:
Sleeping
Sleeping
import streamlit as st | |
def app(): | |
import pydeck as pdk | |
st.title("Property values in Vancouver, Canada") | |
DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/geojson/vancouver-blocks.json" | |
LAND_COVER = [ | |
[[-123.0, 49.196], [-123.0, 49.324], [-123.306, 49.324], [-123.306, 49.196]] | |
] | |
INITIAL_VIEW_STATE = pdk.ViewState( | |
latitude=49.254, longitude=-123.13, zoom=11, max_zoom=16, pitch=45, bearing=0 | |
) | |
polygon = pdk.Layer( | |
"PolygonLayer", | |
LAND_COVER, | |
stroked=False, | |
# processes the data as a flat longitude-latitude pair | |
get_polygon="-", | |
get_fill_color=[0, 0, 0, 20], | |
) | |
geojson = pdk.Layer( | |
"GeoJsonLayer", | |
DATA_URL, | |
opacity=0.8, | |
stroked=False, | |
filled=True, | |
extruded=True, | |
wireframe=True, | |
get_elevation="properties.valuePerSqm / 20", | |
get_fill_color="[255, 255, properties.growth * 255]", | |
get_line_color=[255, 255, 255], | |
) | |
r = pdk.Deck( | |
layers=[polygon, geojson], | |
initial_view_state=INITIAL_VIEW_STATE, | |
height=1000, | |
width="100%", | |
) | |
st.pydeck_chart(r) | |