Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to update shiny example #409

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions examples/shiny/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import geopandas as gpd
from shiny import reactive
from shiny.express import input, ui
from shinywidgets import render_widget

from lonboard import Map, ScatterplotLayer

colors = {
"Red": [200, 0, 0],
"Green": [0, 200, 0],
"Blue": [0, 0, 200],
}

ui.input_select("color_select", "Color", choices=list(colors.keys()))


@render_widget
def layer():
gdf = gpd.read_file(gpd.datasets.get_path("naturalearth_cities"))
return ScatterplotLayer.from_geopandas(gdf, radius_min_pixels=2)


@render_widget
def map():
return Map(layer.widget)


@reactive.effect
def set_fill_color():
layer.widget.get_fill_color = colors[input.color_select()]
Loading