|
import leafmap |
|
import solara |
|
from leafmap.toolbar import change_basemap |
|
|
|
zoom = solara.reactive(2) |
|
center = solara.reactive((20, 0)) |
|
|
|
|
|
class Map(leafmap.Map): |
|
def __init__(self, **kwargs): |
|
super().__init__(**kwargs) |
|
|
|
self.add_basemap("OpenTopoMap") |
|
change_basemap(self) |
|
|
|
|
|
@solara.component |
|
def Page(): |
|
with solara.Column(style={"min-width": "500px"}): |
|
|
|
solara.SliderInt(label="Zoom level", value=zoom, min=1, max=20) |
|
|
|
|
|
Map.element( |
|
zoom=zoom.value, |
|
on_zoom=zoom.set, |
|
center=center.value, |
|
on_center=center.set, |
|
scroll_wheel_zoom=True, |
|
toolbar_ctrl=False, |
|
data_ctrl=False, |
|
|
|
) |
|
solara.Text(f"Zoom: {zoom.value}") |
|
solara.Text(f"Center: {center.value}") |
|
|