File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+
3
+ import marimo
4
+
5
+ __generated_with = "0.13.2"
6
+ app = marimo .App (width = "medium" )
7
+
8
+
9
+ @app .cell
10
+ def _ ():
11
+ import marimo as mo
12
+ import openlayers as ol
13
+ return mo , ol
14
+
15
+
16
+ @app .cell
17
+ def _ ():
18
+ city_centers = {
19
+ "London" : (0.1278 , 51.5074 ),
20
+ "Paris" : (2.3522 , 48.8566 ),
21
+ "New York" : (- 74.0060 , 40.7128 ),
22
+ }
23
+ return (city_centers ,)
24
+
25
+
26
+ @app .cell
27
+ def _ ():
28
+ city = "London"
29
+ return (city ,)
30
+
31
+
32
+ @app .cell
33
+ def _ (city , city_centers , ol ):
34
+ m = ol .MapWidget (ol .View (center = city_centers [city ], zoom = 8 , projection = "EPSG:4326" ))
35
+ return (m ,)
36
+
37
+
38
+ @app .cell
39
+ def _ (m , mo ):
40
+ widget = mo .ui .anywidget (m )
41
+ return (widget ,)
42
+
43
+
44
+ @app .cell
45
+ def _ (widget ):
46
+ widget
47
+ return
48
+
49
+
50
+ @app .cell (hide_code = True )
51
+ def _ (city , city_centers , m , mo ):
52
+ mo .ui .dropdown (
53
+ options = city_centers .keys (),
54
+ label = "City" , value = city ,
55
+ # on_change=lambda key: m.add_view_call("animate", dict(center=city_centers[key], duration=2000))
56
+ on_change = lambda key : m .set_center (* city_centers [key ])
57
+ )
58
+ return
59
+
60
+
61
+ @app .cell
62
+ def _ (widget ):
63
+ widget .value ["view_state" ]
64
+ return
65
+
66
+
67
+ @app .cell
68
+ def _ ():
69
+ return
70
+
71
+
72
+ if __name__ == "__main__" :
73
+ app .run ()
You can’t perform that action at this time.
0 commit comments