Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

MapFlyer

Buttons that animate a lonboard Map to preset locations, driving lonboard’s fly_to from the browser.

Each preset is a dict with a label and deck.gl camera keys (longitude, latitude, zoom, and optionally pitch / bearing). Clicking a button flies the map there — no kernel required, so it behaves the same live and in static export.

Import

from manywidgets.lonboard import MapFlyer

Example

from lonboard import Map, ScatterplotLayer
from manywidgets.lonboard import MapFlyer

layer = ScatterplotLayer.from_geopandas(gdf)
m = Map(layer, basemap=None)
flyer = MapFlyer(m, locations=[
    {"label": "New York", "longitude": -74.0, "latitude": 40.7, "zoom": 10},
    {"label": "London", "longitude": -0.12, "latitude": 51.5, "zoom": 9},
], duration=3000)

# show the control and the map together (see the Layout widgets)
from manywidgets import Column
Column(flyer, m)

API

TraitTypeDefaultDescription
mapInstanceThe lonboard Map to reposition.
locationsListPresets; each a dict with ‘label’ plus camera keys (longitude, latitude, zoom, optionally pitch/bearing).
durationInt4000Fly-to animation duration in milliseconds.
labelUnicode''Optional heading above the buttons.
widget_idUnicode''Stable unique id used for cross-widget linking (auto-assigned).