Skip to content

Display map's legend on saved HTML map #279

Answered by giswqs
OfirMazor asked this question in Q&A
Discussion options

You must be logged in to vote

The geemap legend is built upon ipywidgets HTML widgets, which is not supported when saving the map as an HTML. The workaround is to use ipyleaflet's built-in LegendControl. See below an example.

import geemap
from ipyleaflet import LegendControl

Map = geemap.Map(ee_intialize=False)
legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
Map.add_control(legend)
Map.save("my_map.html")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@OfirMazor
Comment options

Answer selected by giswqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants