import leafmap.foliumap as leafmap
# import leafmap
import streamlit as st
from PIL import Image
def add_logo(logo_path, width, height):
"""Read and return a resized logo"""
logo = Image.open(logo_path)
modified_logo = logo.resize((width, height))
return modified_logo
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 leafmap 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 leafmap 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 leafmap 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.
This app is the fork of https://py.cafe/giswqs/leafmap-solara
''')
m = leafmap.Map(location=[32.774285, 22.625613], zoom_start=14)
zoom = 14
before = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-07-01.tif"
after = "https://github.com/opengeos/datasets/releases/download/raster/Libya-2023-09-13.tif"
m.add_cog_layer(before, name="Before")
m.add_cog_layer(after, name="After")
m.add("layer_manager")
m.split_map(before, after, left_label="Before", right_label="After", add_close_button=True)
m.to_streamlit(height=800, width = 1000)