# !pip install -U geemap import geemap geemap.create_legend( title='NLCD Land Cover Type', builtin_legend='NLCD', draggable=True, output='NLCD_legend.html', ) html = geemap.create_legend( title='NLCD Land Cover Type', builtin_legend='NLCD', draggable=False, position='bottomright', ) widget = geemap.show_html(html) widget widget.close() legend_dict = { "10 Trees": "006400", "20 Shrubland": "ffbb22", "30 Grassland": "ffff4c", "40 Cropland": "f096ff", "50 Built-up": "fa0000", "60 Barren / sparse vegetation": "b4b4b4", "70 Snow and ice": "f0f0f0", "80 Open water": "0064c8", "90 Herbaceous wetland": "0096a0", "95 Mangroves": "00cf75", "100 Moss and lichen": "fae6a0", } geemap.create_legend( title='ESA Land Cover Type', legend_dict=legend_dict, draggable=False, output='ESA_legend.html', ) m = geemap.Map() m.add_basemap('ESA WorldCover 2021') style = { 'position': 'fixed', 'z-index': '9999', 'border': '2px solid grey', 'background-color': 'rgba(255, 255, 255, 0.8)', 'border-radius': '10px', 'padding': '5px', 'font-size': '14px', 'bottom': '20px', 'right': '5px', } m.add_legend( title='ESA Land Cover Type', legend_dict=legend_dict, draggable=False, style=style ) m m = geemap.Map() m.add_basemap('ESA WorldCover 2021') m.add_legend(title='ESA Land Cover Type', builtin_legend='ESA_WorldCover') m m = geemap.Map( center=[40, -100], zoom=4, draw_control=False, measure_control=False, scale_control=False, ) m.split_map(left_layer='ESA WorldCover 2021', right_layer='NLCD 2019 CONUS Land Cover') m.add_legend( title='ESA Land Cover Type', builtin_legend='ESA_WorldCover', draggable=False, position='bottomleft', style={'bottom': '5px'}, ) m.add_legend( title='NLCD Land Cover Type', builtin_legend='NLCD', draggable=False, position='bottomright', ) m