Skip to content


Shiny is a tool to build interactive web applications and dashboards using Python code. Shiny integrates with Jupyter Widgets, which means that Lonboard is supported out-of-the-box.

Pay attention to the "Efficient updates" section of the Shiny documentation. This is the most efficient way to create a reactive map. Take care to not recreate the Map widget from scratch on updates, as that will send data from Python to the browser anew.


import geopandas as gpd
from shiny import reactive
from 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()))

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

def set_fill_color():
    map.widget.layers[0].get_fill_color = colors[input.color_select()]