import solara
import leafmap
#明明設定好了,打開還是常常跑掉不知道原因
zoom = solara.reactive(16)
center = solara.reactive(([22.34910336230622, 120.38834500512858]))
class Map(leafmap.Map):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# self.add_basemap("ROADMAP")
#上次作業的檔案,自行上傳到github
SATELLITE = "https://github.com/RGT1143022/homework20241120/releases/download/v1.0.0/image.tif"
seaGOEJSON = "https://github.com/RGT1143022/homework20241120/releases/download/v1.0.0/sea.geojson"
sea ="https://github.com/RGT1143022/homework20241120/releases/download/v1.0.0/sea.tif"
self.add_cog_layer(SATELLITE, name="SATELLITE")
self.add_cog_layer(sea, name="sea")
self.add("layer_manager")
#tif檔
#self.split_map(SATELLITE, sea, left_label="SATELLITE", right_label="sea", add_close_button=True)
#geojson
self.split_map(SATELLITE, seaGOEJSON, left_label="SATELLITE", right_label="sea", add_close_button=True)
@solara.component
def Page():
solara.lab.theme.dark = False
Map.element(
center = center.value,
zoom = zoom.value,
on_center = center.set,
on_zoom = zoom.set,
height="750px"
)
solara.Text(f"Center: {center.value}")
solara.Text(f"Zoom: {zoom.value}")