import ee import geemap from shiny import reactive from shiny.express import input, ui from shinywidgets import output_widget, render_widget from faicons import icon_svg import ipyleaflet geemap.ee_initialize(service_account=True) city_centers = { "London": (51.5074, 0.1278), "Paris": (48.8566, 2.3522), "New York": (40.7128, -74.0060) } ui.input_select("center", "Center", choices=list(city_centers.keys())) @render_widget def map(): m = ipyleaflet.Map(zoom=4, scroll_wheel_zoom=True) m.layout.height = "800px" dem = ee.Image("USGS/SRTMGL1_003") vis_params = { "min": 0, "max": 4000, "palette": ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"], } tile = geemap.ee_tile_layer(dem, vis_params, "SRTM DEM") url = tile.url layer = ipyleaflet.TileLayer(url=url, attribution="Google", name="DEM") m.add(layer) m.add(ipyleaflet.FullScreenControl()) m.add(ipyleaflet.LayersControl(position='topright')) return m @reactive.effect def _(): map.widget.center = city_centers[input.center()]