Skip to content

Commit 359240f

Browse files
committed
Update example
1 parent ac12920 commit 359240f

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

docs/examples/getting_started/shiny_express.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import json
22

3+
from shiny import reactive
34
from shiny.express import input, render, ui
45

5-
from maplibre import Map, MapOptions, render_maplibregl
6+
from maplibre import Map, MapContext, MapOptions, render_maplibregl
7+
from maplibre.controls import Marker
68

79
ui.h1("My awesome MapLibre map")
810

@@ -26,3 +28,10 @@ def coords():
2628
@render.code
2729
def view_state():
2830
return json.dumps(input.mapgl_view_state(), indent=2)
31+
32+
33+
@reactive.Effect
34+
@reactive.event(input.mapgl_clicked)
35+
async def set_marker():
36+
async with MapContext("mapgl") as m:
37+
m.add_marker(Marker(lng_lat=input.mapgl_clicked()["coords"].values()))

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ description = "Python bindings for MapLibre GL JS"
55
authors = ["Stefan Kuethe <stefan.kuethe@eoda.de>"]
66
readme = "README.md"
77
license = "MIT"
8-
include = [
9-
{ path = "srcjs", format = ["sdist", "wheel"] }
10-
]
8+
include = [{ path = "srcjs", format = ["sdist", "wheel"] }]
119

1210
[tool.poetry.dependencies]
1311
python = ">=3.9,<4"
@@ -16,16 +14,16 @@ htmltools = ">=0.5.1"
1614
jinja2 = ">=3.1.3"
1715
pydantic = ">=2.5.3"
1816
anywidget = ">=0.9.0"
19-
pandas = {version = "^2.1.4", optional = true}
20-
geopandas = {version = "^0.14.2", optional = true}
17+
pandas = { version = "^2.1.4", optional = true }
18+
geopandas = { version = "^0.14.2", optional = true }
2119
branca = "*"
2220

2321
[tool.poetry.group.dev.dependencies]
2422
black = "^24.4.2"
2523
isort = "^5.13.2"
2624
pytest = "^7.4.3"
2725
mkdocs = "^1.5.3"
28-
mkdocstrings = {extras = ["python"], version = "^0.24.0"}
26+
mkdocstrings = { extras = ["python"], version = "^0.24.0" }
2927
mkdocs-material = "^9.5.3"
3028
geopandas = "^0.14.2"
3129
pmtiles = "*"
@@ -34,7 +32,7 @@ pmtiles = "*"
3432
all = ["pandas", "geopandas"]
3533

3634
[tool.black]
37-
line-lenght = 120
35+
line-length = 120
3836

3937
[build-system]
4038
requires = ["poetry-core"]

0 commit comments

Comments
 (0)