In [ ]:
from ipyleaflet import Map, basemaps, WidgetControl
In [ ]:
from ipywidgets import IntSlider, ColorPicker, Button, link
In [ ]:
m = Map(center=(46.01, 6.16), zoom=12, basemap=basemaps.Stamen.Terrain)
m
In [ ]:
zoom_slider = IntSlider(description='Zoom level:', min=0, max=15, value=7)
link((zoom_slider, 'value'), (m, 'zoom'))
widget_control1 = WidgetControl(widget=zoom_slider, position='topright')
m.add_control(widget_control1)
In [ ]:
color_picker = ColorPicker(description='Pick a color:')
widget_control2 = WidgetControl(widget=color_picker, position='bottomright')
m.add_control(widget_control2)
In [ ]:
widget_control2.widget = Button(description='Click me!')
In [ ]:
minimap = Map(
zoom_control=False, attribution_control=False,
zoom=5, center=m.center, basemap=basemaps.Stamen.Terrain
)
minimap.layout.width = '150px'
minimap.layout.height = '150px'
link((minimap, 'center'), (m, 'center'))
minimap_control = WidgetControl(widget=minimap, position='bottomleft')
m.add_control(minimap_control)