Py.Cafe

giswqs/

leafmap-nlcd

Visualizing NLCD Land Cover

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
29
30
import ipyleaflet
import leafmap
import solara

zoom = solara.reactive(4)
center = solara.reactive((40, -100))


class Map(leafmap.Map):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.clear_controls()
        self.add_basemap("SATELLITE")
        self.add_nlcd_ts(left_year=1985, right_year=2023)
        self.add(ipyleaflet.FullScreenControl())


@solara.component
def Page():
    with solara.Column(style={"min-width": "500px"}):
        Map.element(
            zoom=zoom.value,
            on_zoom=zoom.set,
            center=center.value,
            on_center=center.set,
            scroll_wheel_zoom=True,
            toolbar_control=False,
            draw_control=False,
            height="900px"
        )