This example shows how to use the Leaflet side-by-side slider with ipyleaflet.
from ipyleaflet import (
Map, TileLayer, SideBySideControl, basemaps, basemap_to_tiles
)
center = [44.38669150215206, 9.041748046875002]
zoom = 6
m = Map(center=center, zoom=zoom, basemap=basemaps.CartoDB.DarkMatter)
control = SideBySideControl(leftLayer=basemap_to_tiles(basemaps.Strava.Winter),
rightLayer=basemap_to_tiles(basemaps.Strava.Run))
m.add_control(control)
m
Failed to display Jupyter Widget of type Map
.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
m.zoom
6