Maps SDK for Web

Class L.TomTomVectorTrafficFlowLayer

Tile layer for Leaflet that uses the Vector Flow Tiles from Traffic API.

The current vector renderer implementation is based on the Mapbox GL JS library.


L.TomTomVectorTrafficFlowLayer(["absolute"], [options.key], [options.refresh=30000])

Name Description Required Type/Values Default Specifies the style and type of Traffic Flow No "absolute" | "relative" | "relative-delay" "absolute"
options.key Traffic Flow API key that can be obtained from TomTom's developer portal. No String None
options.refresh Traffic refresh inteval in milliseconds. The default value is 30 seconds. If a lower value is provided the default value is used. No Integer 30000
var ttVectorTrafficLayer = new L.TomTomVectorTrafficFlowLayer({
     key: '<Your Traffic Flow API key>',
     refresh: 30000,
     basePath: '<SDK base path>',
     style: 'relative'



name: String

Default: "vectorTrafficFlow"

Name of the vector traffic flow layer. It can be used to differentiate layers.


getStyle( ): Object

Returns the vector style object currently applied to the vector layer.


A object with the current style or undefined if no style was applied yet.


Sets the style for the vector layer.

It expects an object formatted in compliance with the Mapbox style specification.

Name Description Required Type/Values Default
style object which will be applied to vectorLayer Yes Object None


All the class events are keys of the Events static member.

To learn more about how to listen events please refer to this documentation.

MAP_ERROR : String

Fired when an error occurs during the initialization of the vector layer.


Fired immediately after the style was fully loaded.