import ee import geemap import solara zoom = solara.reactive(3) center = solara.reactive([20, 0]) class Map(geemap.Map): def __init__(self, **kwargs): super().__init__(**kwargs) self.add_ee_data() self.add_layer_manager() # self.add_inspector() def add_ee_data(self): gswe = ee.ImageCollection("users/h2i_lab/gswe/gswe_datasets") self.addLayer(gswe.select("esa"), {'palette': ['red']}, "ESA") self.addLayer(gswe.select("osm"), {'palette': ['green']}, "OSM") self.addLayer(gswe.select("jrc"), {'palette': ['blue']}, "JRC") self.addLayer(gswe.select("esri"), {'palette': ['yellow']}, "ESRI") self.addLayer(gswe.select("hydrolakes"), {'palette': ['purple']}, "Hydrolakes") legend_dict = { 'ESA': 'ff0000', 'OSM': '00ff00', 'JRC': '0000ff', 'ESRI': 'ffff00', 'Hydrolakes': '800080' } self.add_legend(legend_dict=legend_dict, position='bottomright') fc = ee.FeatureCollection('users/giswqs/public/countries') style = {'color': '000000ff', 'width': 1, 'fillColor': '00000000'} self.addLayer(fc.style(**style), {}, 'Countries', False) @solara.component def Page(): with solara.Column(style={"min-width": "500px"}): Map.element( # type: ignore zoom=zoom.value, on_zoom=zoom.set, center=center.value, on_center=center.set, scroll_wheel_zoom=True, add_google_map=True, height="800px", )