Map styles & live layers
Switch styles and control real traffic and POI visibility.
On this page
Live layersLive layers#
Bind traffic and poi to booleans, as in the complete example. Both default to false. The standard Neshan styles contain the required sources. MAPLIBRE_STYLES provides light, dark, monochrome_light, monochrome_dark and pastel.
Changing mapStyle preserves the map instance, DOM markers and popups; managed overlays and live visibility are restored after style loading. A custom version-8 style or URL must contain compatible Neshan traffic and points_source sources/layers to display live data. Listen to warning for missing groups and live-layers for matched layer IDs.
Traffic tiles are requested again every 60 seconds while enabled. Data freshness, HTTP caches, availability and quotas are controlled by Neshan. POI may not appear at low zoom. getDiagnostics() counts rendered features in the current view; a checked switch alone does not prove that data loaded.