import streamlit as st
import pydeck as pdk
def app_company_information():
with st.sidebar:
# st.sidebar.image(add_logo(logo_path=f"datafy_logo.png", width=200, height=60))
st.markdown("---")
st.markdown("📖 Demo: Streamlit x PyDeck x PyCafe" )
st.markdown("Made by [DR. AMJAD RAZA](https://www.linkedin.com/in/amjadraza/)")
st.markdown("---")
if __name__ == "__main__":
st.set_page_config(
page_title="Streamlit x PyDeck x PyCafe",
page_icon="🧰",
layout="wide",
initial_sidebar_state="expanded",
menu_items={
'Get Help': 'https://www.datafyassociates.com/',
'Report a bug': "https://www.datafyassociates.com/",
'About': "# A project to showcase geospatial Visualization"
})
app_company_information()
st.header("Demo: Streamlit x PyDeck x PyCafe")
st.markdown('''In this streamlit application, we an compare the floods geospatial data before and after. The images are taken from opengeos GitHub page.
''')
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)
st.pydeck_chart(r, use_container_width=True)