Spaces:
Running
Running
File size: 1,486 Bytes
21fcfde 5ef50b1 21fcfde 5ef50b1 |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
import solara
import leafmap.maplibregl as leafmap
def create_map():
m = leafmap.Map(
style="dark-matter",
projection="globe",
height="750px",
center=[-100, 40],
zoom=4,
sidebar_visible=True,
)
building_pmtiles = "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-04-23/buildings.pmtiles"
road_pmtiles = "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-04-23/transportation.pmtiles"
building_style = {
"layers": [
{
"id": "Buildings",
"source": "buildings",
"source-layer": "building",
"type": "line",
"paint": {
"line-color": "#ff0000",
"line-width": 1,
},
},
]
}
road_style = {
"layers": [
{
"id": "Roads",
"source": "transportation",
"source-layer": "segment",
"type": "line",
"paint": {
"line-color": "#ffffff",
"line-width": 2,
},
},
]
}
m.add_pmtiles(
building_pmtiles, style=building_style, tooltip=True, fit_bounds=False
)
m.add_pmtiles(road_pmtiles, style=road_style, tooltip=True, fit_bounds=False)
return m
@solara.component
def Page():
m = create_map()
return m.to_solara()
|