Skip to content

Commit 585aacf

Browse files
author
Stefan Kuethe
committed
Add drag and drop marimo example
1 parent 4dc6f5d commit 585aacf

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

marimo/drag-and-drop.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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(hide_code=True)
17+
def _(mo):
18+
mo.md(
19+
r"""
20+
## Drag and drop GPX, GeoJSON, KML or TopoJSON files on to the map.
21+
22+
Download sample files from here:
23+
24+
* [states.kml](https://openlayers.org/en/latest/examples/data/kml/states.kml)
25+
* [roads-seoul.geojson](https://openlayers.org/en/latest/examples/data/geojson/roads-seoul.geojson)
26+
* [fr-departments.json](https://openlayers.org/en/latest/examples/data/topojson/fr-departments.json)
27+
* [fells_loop.gpx](https://openlayers.org/en/latest/examples/data/gpx/fells_loop.gpx)
28+
"""
29+
)
30+
return
31+
32+
33+
@app.cell
34+
def _(ol):
35+
m = ol.MapWidget()
36+
return (m,)
37+
38+
39+
@app.cell
40+
def _(m):
41+
m.add_drag_and_drop_interaction()
42+
return
43+
44+
45+
@app.cell
46+
def _(m):
47+
m
48+
return
49+
50+
51+
@app.cell
52+
def _():
53+
return
54+
55+
56+
if __name__ == "__main__":
57+
app.run()

marimo/export-notebooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
output_folder=${1:-dist}
3-
files=("getting-started.py" "pmtiles-vector.py")
3+
files=("getting-started.py" "pmtiles-vector.py" "drag-and-drop.py")
44

55
for file in "${files[@]}"; do
66
without_extension="${file%.*}"

0 commit comments

Comments
 (0)