Skip to content
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
Loading