Traffic
The SDK draws traffic in five ways, each owned by one module. The playground below switches flow and incidents between presets:
| You need… | Use | Data |
|---|---|---|
| Live speed on every road | TrafficFlowModule |
the style's flow tiles |
| Live and planned incidents across the map, filtered | TrafficIncidentsModule |
the style's incident tiles |
| Exactly the incidents you fetched, with focus | TrafficIncidentDetailsModule |
a trafficIncidentDetails response |
| The incidents on one route | RoutingModule |
the route's traffic sections |
| Historical speed and congestion over a region | TrafficAreaAnalyticsModule |
a trafficAreaAnalytics response |
The flow and incident tiles are style parts, hidden until a module shows them.
Traffic incidents
TrafficIncidentsModule shows the live incidents of the whole map, such as accidents, closures, roadworks and weather, as lines and category icons. You filter them by category, severity, delay and road type, and bring in the planned ones too. It needs no request.
Traffic flow
TrafficFlowModule colours every road by its speed relative to free flow, from free-flowing to stationary, with closed roads outlined.
Traffic flow as data
Orbis flow comes as vector tiles only, so you can read it only with TrafficFlowModule.getRenderedFeatures() over the current viewport. What the flow data can and cannot tell you lists what each segment carries. Historical speed and congestion over an area come from Traffic Area Analytics.
Traffic incident details
TrafficIncidentDetailsModule draws exactly the incidents a trafficIncidentDetails call returned, and highlights a subset with setFocus. Use it if your app also needs the typed incidents, for a list, a popup or a route.
Traffic along routes
RoutingModule draws the incidents of a calculated route as its traffic sections, in the incident colours.
Traffic area analytics
TrafficAreaAnalyticsModule draws a region's historical traffic as hexagon or square grids, flat or extruded, or as a heatmap, coloured by congestion, speed, travel time or network length.
Related guides and examples
- Traffic config playground - Flow and incident presets, with every setting from the knob catalogues
- Route with traffic monitoring - A route replanned every minute, its live delays redrawn
- Traffic incident focus - A city's incidents brought forward and the rest of the map pushed back
- Core traffic types - The incident categories and delay magnitudes every traffic API shares