Py.Cafe

smakion/

solara-leafmap-world-map

Interactive World Map with Solara and Leafmap

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
import solara
import leafmap

zoom = solara.reactive(2)
center = solara.reactive((20,0))

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 = "750px"
    )
    solara.Text(f"Center: {center.value}")
    solara.Text(f"Center: {zoom.value}")