Spaces:
Running
Running
Add sidebar example
Browse files- pages/01_globe.py +1 -1
- pages/02_sidebar.py +32 -0
- requirements.txt +1 -1
pages/01_globe.py
CHANGED
@@ -6,7 +6,7 @@ import leafmap.maplibregl as leafmap
|
|
6 |
def create_map():
|
7 |
|
8 |
m = leafmap.Map(style="liberty", projection="globe", height="750px")
|
9 |
-
m.
|
10 |
return m
|
11 |
|
12 |
|
|
|
6 |
def create_map():
|
7 |
|
8 |
m = leafmap.Map(style="liberty", projection="globe", height="750px")
|
9 |
+
m.create_container(sidebar_visible=True)
|
10 |
return m
|
11 |
|
12 |
|
pages/02_sidebar.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import solara
|
2 |
+
import reacton.ipyvuetify as rv
|
3 |
+
import leafmap.maplibregl as leafmap
|
4 |
+
|
5 |
+
|
6 |
+
def create_map():
|
7 |
+
|
8 |
+
m = leafmap.Map(style="dark-matter", projection="globe", height="750px")
|
9 |
+
m.create_container(sidebar_visible=True)
|
10 |
+
|
11 |
+
m.add_ee_layer(asset_id="ESA/WorldCover/v200", opacity=0.8)
|
12 |
+
m.add_overture_3d_buildings()
|
13 |
+
|
14 |
+
m.add_legend_to_sidebar(
|
15 |
+
builtin_legend="ESA_WorldCover", title="Land Cover Type", shape_type="rectangle"
|
16 |
+
)
|
17 |
+
m.add_colorbar_to_sidebar(cmap="terrain", label="Elevation")
|
18 |
+
|
19 |
+
image = "https://i.imgur.com/KeiAsTv.gif"
|
20 |
+
m.add_image_to_sidebar(image=image, expanded=False)
|
21 |
+
|
22 |
+
video = "https://static-assets.mapbox.com/mapbox-gl-js/drone.mp4"
|
23 |
+
m.add_video_to_sidebar(video, expanded=False)
|
24 |
+
# m.set_sidebar_width(680)
|
25 |
+
return m
|
26 |
+
|
27 |
+
|
28 |
+
@solara.component
|
29 |
+
def Page():
|
30 |
+
m = create_map()
|
31 |
+
container = rv.Row(children=[m.container])
|
32 |
+
return container
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
geopandas
|
2 |
-
leafmap
|
3 |
maplibre
|
4 |
solara
|
|
|
1 |
geopandas
|
2 |
+
leafmap>=0.46.6
|
3 |
maplibre
|
4 |
solara
|