Spaces:
Running
Running
Add PMTiles example
Browse files- pages/01_globe.py +1 -1
- pages/02_sidebar.py +1 -1
- pages/03_overture.py +27 -0
- pages/04_pmtiles.py +58 -0
pages/01_globe.py
CHANGED
@@ -5,7 +5,7 @@ import leafmap.maplibregl as leafmap
|
|
5 |
|
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 |
|
|
|
5 |
|
6 |
def create_map():
|
7 |
|
8 |
+
m = leafmap.Map(style="liberty", projection="globe", height="750px", zoom=2.5)
|
9 |
m.create_container(sidebar_visible=True)
|
10 |
return m
|
11 |
|
pages/02_sidebar.py
CHANGED
@@ -5,7 +5,7 @@ import leafmap.maplibregl as leafmap
|
|
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)
|
|
|
5 |
|
6 |
def create_map():
|
7 |
|
8 |
+
m = leafmap.Map(style="dark-matter", projection="globe", height="750px", zoom=2.5)
|
9 |
m.create_container(sidebar_visible=True)
|
10 |
|
11 |
m.add_ee_layer(asset_id="ESA/WorldCover/v200", opacity=0.8)
|
pages/03_overture.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
9 |
+
center=[-74.0095, 40.7046],
|
10 |
+
zoom=16,
|
11 |
+
pitch=60,
|
12 |
+
bearing=-17,
|
13 |
+
style="positron",
|
14 |
+
height="750px",
|
15 |
+
)
|
16 |
+
m.create_container(sidebar_visible=True)
|
17 |
+
m.add_basemap("Esri.WorldImagery", visible=False)
|
18 |
+
m.add_overture_3d_buildings(template="simple")
|
19 |
+
m.add_layer_control()
|
20 |
+
return m
|
21 |
+
|
22 |
+
|
23 |
+
@solara.component
|
24 |
+
def Page():
|
25 |
+
m = create_map()
|
26 |
+
container = rv.Row(children=[m.container])
|
27 |
+
return container
|
pages/04_pmtiles.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
9 |
+
style="dark-matter",
|
10 |
+
projection="globe",
|
11 |
+
height="750px",
|
12 |
+
center=[-100, 40],
|
13 |
+
zoom=4,
|
14 |
+
)
|
15 |
+
m.create_container(sidebar_visible=True)
|
16 |
+
|
17 |
+
building_pmtiles = "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-04-23/buildings.pmtiles"
|
18 |
+
road_pmtiles = "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-04-23/transportation.pmtiles"
|
19 |
+
building_style = {
|
20 |
+
"layers": [
|
21 |
+
{
|
22 |
+
"id": "Buildings",
|
23 |
+
"source": "buildings",
|
24 |
+
"source-layer": "building",
|
25 |
+
"type": "line",
|
26 |
+
"paint": {
|
27 |
+
"line-color": "#ff0000",
|
28 |
+
"line-width": 1,
|
29 |
+
},
|
30 |
+
},
|
31 |
+
]
|
32 |
+
}
|
33 |
+
road_style = {
|
34 |
+
"layers": [
|
35 |
+
{
|
36 |
+
"id": "Roads",
|
37 |
+
"source": "transportation",
|
38 |
+
"source-layer": "segment",
|
39 |
+
"type": "line",
|
40 |
+
"paint": {
|
41 |
+
"line-color": "#ffffff",
|
42 |
+
"line-width": 2,
|
43 |
+
},
|
44 |
+
},
|
45 |
+
]
|
46 |
+
}
|
47 |
+
m.add_pmtiles(
|
48 |
+
building_pmtiles, style=building_style, tooltip=True, fit_bounds=False
|
49 |
+
)
|
50 |
+
m.add_pmtiles(road_pmtiles, style=road_style, tooltip=True, fit_bounds=False)
|
51 |
+
return m
|
52 |
+
|
53 |
+
|
54 |
+
@solara.component
|
55 |
+
def Page():
|
56 |
+
m = create_map()
|
57 |
+
container = rv.Row(children=[m.container])
|
58 |
+
return container
|