Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Dec 17, 2024
1 parent ac12920 commit 359240f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 10 additions & 1 deletion docs/examples/getting_started/shiny_express.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json

from shiny import reactive
from shiny.express import input, render, ui

from maplibre import Map, MapOptions, render_maplibregl
from maplibre import Map, MapContext, MapOptions, render_maplibregl
from maplibre.controls import Marker

ui.h1("My awesome MapLibre map")

Expand All @@ -26,3 +28,10 @@ def coords():
@render.code
def view_state():
return json.dumps(input.mapgl_view_state(), indent=2)


@reactive.Effect
@reactive.event(input.mapgl_clicked)
async def set_marker():
async with MapContext("mapgl") as m:
m.add_marker(Marker(lng_lat=input.mapgl_clicked()["coords"].values()))
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ description = "Python bindings for MapLibre GL JS"
authors = ["Stefan Kuethe <[email protected]>"]
readme = "README.md"
license = "MIT"
include = [
{ path = "srcjs", format = ["sdist", "wheel"] }
]
include = [{ path = "srcjs", format = ["sdist", "wheel"] }]

[tool.poetry.dependencies]
python = ">=3.9,<4"
Expand All @@ -16,16 +14,16 @@ htmltools = ">=0.5.1"
jinja2 = ">=3.1.3"
pydantic = ">=2.5.3"
anywidget = ">=0.9.0"
pandas = {version = "^2.1.4", optional = true}
geopandas = {version = "^0.14.2", optional = true}
pandas = { version = "^2.1.4", optional = true }
geopandas = { version = "^0.14.2", optional = true }
branca = "*"

[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
isort = "^5.13.2"
pytest = "^7.4.3"
mkdocs = "^1.5.3"
mkdocstrings = {extras = ["python"], version = "^0.24.0"}
mkdocstrings = { extras = ["python"], version = "^0.24.0" }
mkdocs-material = "^9.5.3"
geopandas = "^0.14.2"
pmtiles = "*"
Expand All @@ -34,7 +32,7 @@ pmtiles = "*"
all = ["pandas", "geopandas"]

[tool.black]
line-lenght = 120
line-length = 120

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 359240f

Please sign in to comment.