66 gradio
In [1]:
Copied!
# !pip install -U leafmap
# !pip install -U leafmap
Folium backend¶
In [2]:
Copied!
import gradio as gr
import leafmap.foliumap as leafmap
def split(left, right):
m = leafmap.Map()
m.split_map(left_layer=left, right_layer=right)
return m.to_gradio()
left_url = (
"https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
)
right_url = (
"https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif"
)
left_input = gr.Textbox(value=left_url, label="Left Layer URL")
right_input = gr.Textbox(value=right_url, label="Right Layer URL")
demo = gr.Interface(split, [left_input, right_input], "html")
# demo.launch()
import gradio as gr
import leafmap.foliumap as leafmap
def split(left, right):
m = leafmap.Map()
m.split_map(left_layer=left, right_layer=right)
return m.to_gradio()
left_url = (
"https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
)
right_url = (
"https://github.com/opengeos/data/releases/download/raster/Libya-2023-09-13.tif"
)
left_input = gr.Textbox(value=left_url, label="Left Layer URL")
right_input = gr.Textbox(value=right_url, label="Right Layer URL")
demo = gr.Interface(split, [left_input, right_input], "html")
# demo.launch()
Plotly backend¶
In [3]:
Copied!
import gradio as gr
import leafmap.plotlymap as leafmap
def viz_cog(url):
m = leafmap.Map()
m.add_cog_layer(url)
return m
url = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
demo = gr.Interface(
fn=viz_cog,
inputs=gr.Text(value=url, label="Enter a COG URL"),
outputs=gr.Plot(),
)
# demo.launch()
import gradio as gr
import leafmap.plotlymap as leafmap
def viz_cog(url):
m = leafmap.Map()
m.add_cog_layer(url)
return m
url = "https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif"
demo = gr.Interface(
fn=viz_cog,
inputs=gr.Text(value=url, label="Enter a COG URL"),
outputs=gr.Plot(),
)
# demo.launch()