Maps SDK for Web
Class L.TomTomVectorTrafficIncidents
Tile layer for Leaflet that uses the Vector Traffic Incidents from TomTom Online Traffic.
The current vector renderer implementation is based on the Mapbox GL JS library.
Constructor
L.TomTomVectorTrafficIncidents([options.style="s1"], [options.key], [options.refresh=30000])
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
options.style | Specifies the style and type of traffic incidents | No | "s1" | "s2" | "s3" | "night" | "s1" |
options.key | Traffic Flow API key that can be obtained from TomTom's developer portal. | No | String | None |
options.refresh | Traffic refresh interval in milliseconds. The default value is 30 seconds. If a lower value is provided the default value is used. | No | Integer | 30000 |
Example
var ttVectorTrafficIncidents = new L.TomTomVectorTrafficIncidents({
key: '<Your Traffic Flow API key>',
refresh: 30000,
basePath: '<SDK base path>',
style: 's1'
});
map.addLayer(ttVectorTrafficIncidents);
Properties
name: String
Default: "vector"
Methods
getStyle( ): Object
Returns the vector style object currently applied to the vector layer.
Returns
A object with the current style or undefined if no style was applied yet.
setStyle(style)
Sets the style for the vector layer.
It expects an object formatted in compliance with the Mapbox style specification.
Parameters
Name | Description | Required | Type/Values | Default |
---|---|---|---|---|
style | object which will be applied to vectorLayer | Yes | Object | None |
Events
All the class events are keys of the Events static member.
To learn more about how to listen events please refer to this documentation.