Skip to content

Commit

Permalink
Updated layer manager GUI (#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jun 4, 2023
1 parent cf97f5d commit a133a6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions geemap/geemap.py
Expand Up @@ -693,6 +693,9 @@ def add(self, object):

super().add(object)

if hasattr(self, "layer_manager_widget"):
self.update_layer_manager()

def set_options(self, mapTypeId="HYBRID", styles=None, types=None):
"""Adds Google basemap and controls to the ipyleaflet map.
Expand Down Expand Up @@ -6761,6 +6764,12 @@ def add_layer_manager(self, position="topright", opened=True):

layer_manager_gui(self, position, opened)

def update_layer_manager(self):
"""Update the Layer Manager."""
from .toolbar import layer_manager_gui

self.layer_manager_widget.children = layer_manager_gui(self, return_widget=True)

def add_widget(self, content, position="bottomright", **kwargs):
"""Add a widget (e.g., text, HTML, figure) to the map.
Expand Down
3 changes: 3 additions & 0 deletions geemap/toolbar.py
Expand Up @@ -5009,6 +5009,9 @@ def layer_chk_changed(change):
layers_button.observe(layers_btn_click, "value")
layers_button.value = opened

if not hasattr(m, "layer_manager_widget"):
m.layer_manager_widget = toolbar_footer

if return_widget:
return m.layer_widget
else:
Expand Down

0 comments on commit a133a6d

Please sign in to comment.