import solara
import leafmap
# Define reactive zoom and center values
zoom = solara.reactive(17)
center = solara.reactive((19.959987564207466, 85.45383423792339))
class MyMap(leafmap.Map):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.add("layer_manager")
# URLs for the images with correct access to raw content
before = "https://github.com/hemanya2003/datasets/raw/main/Before.jp2"
after = "https://github.com/hemanya2003/datasets/raw/main/After.jp2"
# Create an instance of MyMap and add tile layers with attribution
map_instance = MyMap(center=center.value, zoom=zoom.value)
map_instance.add_tile_layer(url=before, name="Before", attribution="Source: Example Attribution")
map_instance.add_tile_layer(url=after, name="After", attribution="Source: Example Attribution")
@solara.component
def Page():
solara.lab.theme.dark = False
return map_instance.element(
center=center.value,
zoom=zoom.value,
on_center=center.set,
on_zoom=zoom.set,
height="750px"
)