Skip to content

Commit 7fffdcb

Browse files
committed
Add deckgl example
1 parent 81b7ec8 commit 7fffdcb

2 files changed

Lines changed: 96 additions & 13 deletions

File tree

maplibre/srcjs/maplibre.anywidget.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

marimo/deckgl.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import marimo
2+
3+
__generated_with = "0.10.17"
4+
app = marimo.App(width="medium")
5+
6+
7+
@app.cell
8+
def _():
9+
import marimo as mo
10+
import maplibre as mlb
11+
return mlb, mo
12+
13+
14+
@app.cell
15+
def _():
16+
grid = {
17+
"@@type": "GridLayer",
18+
"id": "GridLayer",
19+
"data": "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-bike-parking.json",
20+
"extruded": True,
21+
"getPosition": "@@=COORDINATES",
22+
"getColorWeight": "@@=SPACES",
23+
"getElevationWeight": "@@=SPACES",
24+
"elevationScale": 4,
25+
"cellSize": 100,
26+
"pickable": True,
27+
}
28+
return (grid,)
29+
30+
31+
@app.cell
32+
def _(mlb):
33+
map_options = mlb.MapOptions(
34+
# style=mlb.Carto.POSITRON,
35+
center=(-122.4, 37.74),
36+
zoom=12,
37+
hash=True,
38+
pitch=40,
39+
)
40+
return (map_options,)
41+
42+
43+
@app.cell
44+
def _(map_options, mlb):
45+
# m = mlb.MapWidget(map_options, controls=[mlb.controls.NavigationControl()])
46+
m = mlb.MapWidget(map_options)
47+
return (m,)
48+
49+
50+
@app.cell
51+
def _(grid, m):
52+
#m.add_call("setCenter", (-122.4, 37.74))
53+
#m.add_call("setZoom", 12)
54+
m.add_call("addMapboxOverlay", [grid])
55+
return
56+
57+
58+
@app.cell
59+
def _(m, mo):
60+
widget = mo.ui.anywidget(m)
61+
return (widget,)
62+
63+
64+
@app.cell
65+
def _(widget):
66+
widget
67+
# m
68+
return
69+
70+
71+
@app.cell
72+
def _():
73+
# m.add_call("addMapboxOverlay", [grid])
74+
return
75+
76+
77+
@app.cell
78+
def _():
79+
return
80+
81+
82+
if __name__ == "__main__":
83+
app.run()

0 commit comments

Comments
 (0)