Maps SDK for Web

Class L.TomTomTrafficIncidentsLayer

This is an extension to Leaflet allowing to display the TomTom traffic incidents layer.

It uses the tomtom.trafficIncidents service in order to retrieve incidents details.

A look and feel, together with a clustering behaviour, can be modified by passing the pointToLayer function.

Constructor

L.TomTomTrafficIncidentsLayer([options], [options.key] API key that can be obtained from [TomTom's developer portal])

Parameters
Name Description Required Type/Values Default
options It accepts all the options that Leaflet's GeoJSON class allows. The additional options, which are TomTom specific, are described below. No Object None
options.pointToLayer This function is used to convert vector traffic incidents into a layer of markers on the map. It takes the GeoJSON feature as the first parameter and the latlng object as the second one. It returns a layer that will be added to the map. If this is omitted, the default implementation is used. No Function default
options.imperialDistance Set this option if you want to use a specific unit measurement system for the new instance of the layer instead of use the default unit No Boolean null
options.createPopupForCluster Set this to true if you want popup for clusters to be generated No Boolean false
options.diff If false, force a 'full' update on traffic markers. No Boolean false
options.noRefresh Disables periodic updates of traffic layers. No Boolean None
options.refresh The traffic incidents information changes and needs to be updated periodically. By default, it is refreshed every 30 seconds. This parameter's value represents the time in milliseconds between each update interval. The value must be 0 or greater. No Number 30000
[options.key] API key that can be obtained from [TomTom's developer portal] (https://developer.tomtom.com). This is a key for the traffic services. Yes String None

Properties

name: String

Default: "TomTomTrafficIncidentsLayer"

Name of traffic incidents layer. It can be used to differentiate layers.

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.

TRAFFIC_INCIDENTS_RECEIVED

Fired when new incidents data is received.
Properties
Name Description Type/Values Default
data GeoJson data Object None
layers Array of markers created to display the incidents L.Marker None