Py.Cafe

simeleketewolokodore/

solara-interactive

Interactive Leafmap with Solara

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import leafmap
import solara

zoom = solara.reactive(5)
center = solara.reactive((-1.0106897, 114.389164))


class Map(leafmap.Map):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
       

@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="500px"

    )

    solara.Text(f"Center : {center.value}")
    solara.Text(f"Zoom : {zoom.value}")