OptionalactiveMetric?: AreaAnalyticsMetricKeyThe metric that drives color and extrusion height.
OptionalbeforeLayerConfig?: AreaAnalyticsBeforeLayerConfigWhere the analytics layers sit in the map's layer stack, for all display modes or per mode.
OptionaldisplayMode?: AreaAnalyticsDisplayModeVisualization mode.
Optionallayers?: TrafficAreaAnalyticsLayersConfigMapLibre overrides for the heatmap, the cells of each grid and the region boundary. A layer
hidden through its entry's layout.visibility stays hidden in its display mode.
Optionalmetrics?: Partial<Record<AreaAnalyticsMetricKey, AreaAnalyticsMetricConfig>>Per-metric visualization configuration (palette or colour stops, height, filters).
Metrics not listed here fall back to defaults (the trafficLight palette, metric-dependent height scale).
updateConfig replaces this whole record, so to change one metric and keep the others' settings,
use setPalette, setColorStops, setHeight or setFilters with that metric.
OptionalregionPolygon?: AreaAnalyticsRegionPolygonConfigDisplay options for the region polygon boundary drawn alongside the analytics data.
Optionalvisible?: booleanWhether the area analytics layers are visible.
activeMetric sets the active metric, 'congestionLevel' by default. Per-metric style settings
(palette or colour stops, height, filters) sit under metrics, keyed by AreaAnalyticsMetricKey.
So you can pre-configure multiple metrics independently and switch between them at runtime with
updateConfig({ activeMetric }).
const config: TrafficAreaAnalyticsModuleConfig = {
displayMode: 'hexgrid-3d',
activeMetric: 'congestionLevel',
metrics: {
congestionLevel: {
palette: 'heat',
height: { maxMeters: 80, scaleMode: 'predefinedRange' },
filters: { min: 10 },
},
speed: {
colorStops: {
scaleMode: 'raw',
stops: [
{ value: 0, color: '#e03030' },
{ value: 60, color: '#f5a623' },
{ value: 120, color: '#2dc653' },
],
},
},
},
};
Configuration for the Traffic Area Analytics visualization module.