Skip to content

Basemap

Switches the active basemap. Lists every entry from settings.basemaps with a thumbnail and name; picking one swaps the map style. Your layers and visibility/opacity edits survive the switch.

  • id: basemap
  • Surfaces: top-bar, side-panel

Place it

sidePanelWidgets: [{ widgetName: 'basemap' }],
// or
topBarWidgets: [{ widgetName: 'basemap' }],

Configuration

The basemap list comes from the top-level basemaps array:

basemaps: [
  { id: 'positron', name: 'Positron', style: 'https://tiles.openfreemap.org/styles/positron' },
  { id: 'liberty',  name: 'Liberty',  style: 'https://tiles.openfreemap.org/styles/liberty' },
],
Field Type Description
id string Unique id (also used to resolve the thumbnail)
name string Display name in the switcher
style string \| StyleSpecification Style URL or inline style object
thumbnail string Optional explicit thumbnail image

See Basemaps for the full field reference, or the default catalog for the list of all 17 basemaps shipped with the demo.

Thumbnails

If you don't set thumbnail, the widget looks for an image at ./basemap-images/<id>.jpg inside the widget folder. The filename must exactly match the basemap's id — not its name or anything else. The demo ships thumbnails for its OpenFreeMap and Esri entries. Images are center-cropped into a uniform square, so near-square screenshots all line up. A missing image falls back to a neutral placeholder. If you add a new basemap, you will need to add a photo manually.