12 split map
Creating a split-panel map with only one line of code
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
This notebook example requires the ipyleaflet plotting backend. Folium is not supported.
In [2]:
Copied!
import leafmap.leafmap as leafmap
import leafmap.leafmap as leafmap
Print out the list of available basemaps.
In [3]:
Copied!
print(leafmap.leafmap_basemaps.keys())
print(leafmap.leafmap_basemaps.keys())
dict_keys(['OpenStreetMap', 'ROADMAP', 'SATELLITE', 'TERRAIN', 'HYBRID', 'FWS NWI Wetlands', 'FWS NWI Wetlands Raster', 'NLCD 2019 CONUS Land Cover', 'NLCD 2016 CONUS Land Cover', 'NLCD 2013 CONUS Land Cover', 'NLCD 2011 CONUS Land Cover', 'NLCD 2008 CONUS Land Cover', 'NLCD 2006 CONUS Land Cover', 'NLCD 2004 CONUS Land Cover', 'NLCD 2001 CONUS Land Cover', 'USGS NAIP Imagery', 'USGS Hydrography', 'USGS 3DEP Elevation', 'BasemapAT.basemap', 'BasemapAT.grau', 'BasemapAT.highdpi', 'BasemapAT.orthofoto', 'BasemapAT.overlay', 'BasemapAT.surface', 'BasemapAT.terrain', 'CartoDB.DarkMatter', 'CartoDB.DarkMatterNoLabels', 'CartoDB.DarkMatterOnlyLabels', 'CartoDB.Positron', 'CartoDB.PositronNoLabels', 'CartoDB.PositronOnlyLabels', 'CartoDB.Voyager', 'CartoDB.VoyagerLabelsUnder', 'CartoDB.VoyagerNoLabels', 'CartoDB.VoyagerOnlyLabels', 'CyclOSM', 'Esri.AntarcticBasemap', 'Esri.ArcticOceanBase', 'Esri.ArcticOceanReference', 'Esri.DeLorme', 'Esri.NatGeoWorldMap', 'Esri.OceanBasemap', 'Esri.WorldGrayCanvas', 'Esri.WorldImagery', 'Esri.WorldPhysical', 'Esri.WorldShadedRelief', 'Esri.WorldStreetMap', 'Esri.WorldTerrain', 'Esri.WorldTopoMap', 'FreeMapSK', 'Gaode.Normal', 'Gaode.Satellite', 'GeoportailFrance.orthos', 'GeoportailFrance.parcels', 'GeoportailFrance.plan', 'HikeBike.HikeBike', 'HikeBike.HillShading', 'Hydda.Base', 'Hydda.Full', 'Hydda.RoadsAndLabels', 'JusticeMap.americanIndian', 'JusticeMap.asian', 'JusticeMap.black', 'JusticeMap.hispanic', 'JusticeMap.income', 'JusticeMap.multi', 'JusticeMap.nonWhite', 'JusticeMap.plurality', 'JusticeMap.white', 'MtbMap', 'NASAGIBS.BlueMarble', 'NASAGIBS.BlueMarble3031', 'NASAGIBS.BlueMarble3413', 'NASAGIBS.ModisAquaBands721CR', 'NASAGIBS.ModisAquaTrueColorCR', 'NASAGIBS.ModisTerraAOD', 'NASAGIBS.ModisTerraBands367CR', 'NASAGIBS.ModisTerraBands721CR', 'NASAGIBS.ModisTerraChlorophyll', 'NASAGIBS.ModisTerraLSTDay', 'NASAGIBS.ModisTerraSnowCover', 'NASAGIBS.ModisTerraTrueColorCR', 'NASAGIBS.ViirsEarthAtNight2012', 'NASAGIBS.ViirsTrueColorCR', 'NLS', 'OPNVKarte', 'OneMapSG.Default', 'OneMapSG.Grey', 'OneMapSG.LandLot', 'OneMapSG.Night', 'OneMapSG.Original', 'OpenAIP', 'OpenFireMap', 'OpenRailwayMap', 'OpenSeaMap', 'OpenSnowMap.pistes', 'OpenStreetMap.BZH', 'OpenStreetMap.BlackAndWhite', 'OpenStreetMap.CH', 'OpenStreetMap.DE', 'OpenStreetMap.France', 'OpenStreetMap.HOT', 'OpenStreetMap.Mapnik', 'OpenTopoMap', 'SafeCast', 'Stadia.AlidadeSmooth', 'Stadia.AlidadeSmoothDark', 'Stadia.OSMBright', 'Stadia.Outdoors', 'Stamen.Terrain', 'Stamen.TerrainBackground', 'Stamen.TerrainLabels', 'Stamen.Toner', 'Stamen.TonerBackground', 'Stamen.TonerHybrid', 'Stamen.TonerLabels', 'Stamen.TonerLines', 'Stamen.TonerLite', 'Stamen.TopOSMFeatures', 'Stamen.TopOSMRelief', 'Stamen.Watercolor', 'Strava.All', 'Strava.Ride', 'Strava.Run', 'Strava.Water', 'Strava.Winter', 'SwissFederalGeoportal.JourneyThroughTime', 'SwissFederalGeoportal.NationalMapColor', 'SwissFederalGeoportal.NationalMapGrey', 'SwissFederalGeoportal.SWISSIMAGE', 'USGS.USImagery', 'USGS.USImageryTopo', 'USGS.USTopo', 'WaymarkedTrails.cycling', 'WaymarkedTrails.hiking', 'WaymarkedTrails.mtb', 'WaymarkedTrails.riding', 'WaymarkedTrails.skating', 'WaymarkedTrails.slopes', 'nlmaps.grijs', 'nlmaps.luchtfoto', 'nlmaps.pastel', 'nlmaps.standaard', 'nlmaps.water', 'Planet_2016q1', 'Planet_2016q2', 'Planet_2016q3', 'Planet_2016q4', 'Planet_2017q1', 'Planet_2017q2', 'Planet_2017q3', 'Planet_2017q4', 'Planet_2018q1', 'Planet_2018q2', 'Planet_2018q3', 'Planet_2018q4', 'Planet_2019q1', 'Planet_2019q2', 'Planet_2019q3', 'Planet_2019q4', 'Planet_2020q1', 'Planet_2020q2', 'Planet_2020q3', 'Planet_2020q4', 'Planet_2021q1', 'Planet_2021q2', 'Planet_2021q3', 'Planet_2021q4', 'Planet_2016_01', 'Planet_2016_02', 'Planet_2016_03', 'Planet_2016_04', 'Planet_2016_05', 'Planet_2016_06', 'Planet_2016_07', 'Planet_2016_08', 'Planet_2016_09', 'Planet_2016_10', 'Planet_2016_11', 'Planet_2016_12', 'Planet_2017_01', 'Planet_2017_02', 'Planet_2017_03', 'Planet_2017_04', 'Planet_2017_05', 'Planet_2017_06', 'Planet_2017_07', 'Planet_2017_08', 'Planet_2017_09', 'Planet_2017_10', 'Planet_2017_11', 'Planet_2017_12', 'Planet_2018_01', 'Planet_2018_02', 'Planet_2018_03', 'Planet_2018_04', 'Planet_2018_05', 'Planet_2018_06', 'Planet_2018_07', 'Planet_2018_08', 'Planet_2018_09', 'Planet_2018_10', 'Planet_2018_11', 'Planet_2018_12', 'Planet_2019_01', 'Planet_2019_02', 'Planet_2019_03', 'Planet_2019_04', 'Planet_2019_05', 'Planet_2019_06', 'Planet_2019_07', 'Planet_2019_08', 'Planet_2019_09', 'Planet_2019_10', 'Planet_2019_11', 'Planet_2019_12', 'Planet_2020_01', 'Planet_2020_02', 'Planet_2020_03', 'Planet_2020_04', 'Planet_2020_05', 'Planet_2020_06', 'Planet_2020_07', 'Planet_2020_08', 'Planet_2020_09', 'Planet_2020_10', 'Planet_2020_11', 'Planet_2020_12', 'Planet_2021_01', 'Planet_2021_02', 'Planet_2021_03', 'Planet_2021_04', 'Planet_2021_05', 'Planet_2021_06', 'Planet_2021_07', 'Planet_2021_08', 'Planet_2021_09', 'Planet_2021_10', 'Planet_2021_11', 'Planet_2021_12', 'Planet_2022_01', 'Planet_2022_02'])
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.
In [4]:
Copied!
leafmap.split_map(left_layer="ROADMAP", right_layer="HYBRID")
leafmap.split_map(left_layer="ROADMAP", right_layer="HYBRID")
Hide the zoom control from the map.
In [5]:
Copied!
leafmap.split_map(
left_layer="Esri.WorldTopoMap", right_layer="OpenTopoMap", zoom_control=False
)
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.
In [6]:
Copied!
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,
)
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,
)
Last update:
2022-03-14