Skip to content

12 split map

image image image

Creating a split-panel map with only one line of code

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap

This notebook example requires the ipyleaflet plotting backend. Folium is not supported.

1
import leafmap.leafmap as leafmap

Print out the list of available basemaps.

1
print(leafmap.basemaps.keys())

Create a split-panel map by specifying the left_layer and right_layer, which can be chosen from the basemap names, or any custom XYZ tile layer.

1
leafmap.split_map(left_layer="ROADMAP", right_layer="HYBRID")

Hide the zoom control from the map.

1
2
3
leafmap.split_map(
    left_layer="Esri.WorldTopoMap", right_layer="OpenTopoMap", zoom_control=False
)

Add labels to the map and change the default map center and zoom level.

1
2
3
4
5
6
7
8
9
leafmap.split_map(
    left_layer="NLCD 2001 CONUS Land Cover",
    right_layer="NLCD 2016 CONUS Land Cover",
    left_label="2001",
    right_label="2016",
    label_position="bottom",
    center=[36.1, -114.9],
    zoom=10,
)