Maps SDK for Web

tt.services.incidentDetails

Provides current traffic incidents in a given region, on a given zoom level with a given style using the TomTom Traffic API - Traffic Incidents Details

The current road situation is updated every minute. Please use the IncidentViewport service in conjunction with your request to get traffic incidents aligned with other services.

Parameters need to be passed to the constructor. The method go performs the actual call.

The SDK provides a Promise polyfill for browsers (IE<9) without native ECMAScript 6 support.

The final response from this service is a GeoJSON object.

Constructor

tt.services.incidentDetails([options])

Example
function callbackFn(response) {
  console.log(response);
}
tt.services.incidentDetails({
  key: '<Your API key>',
  boundingBox: '0,0,1,1',
  style: 's1',
  zoomLevel: 12
})
.go()
.then(callbackFn);
Parameters
Name Description
options
Object
default:None
options.boundingBox
Object
default:None

bbox


The corners of the area of the map to report on. These are two latitude-longitude pairs describing corners of the bounding box. First pair for the lower left corner and second for the upper right. All values should be separated by commas. E.g. '40.5, -20.5, 50.5, -21.5'
options.expandCluster
Boolean
default:None

Determines if the service should include details of incidents that are clustered.


Tells the service to separately list all traffic incidents in a cluster. When is enabled the clusters in the response will be represented as geometry collections, and the cluster coordinates will appear as clusterCoordinates parameters. Enabling this feature is useful when the user wants to obtain details of the incidents that are being clustered, or wants to perform a client-side clustering.
options.key
String
default:None

A valid API Key for the requested service.


A valid API Key is required to make use of the given service. It can be issued in the Developer Portal.
options.language
String
default:null

Language code that decides in which language the search results should be returned.


The value should correspond to one of the supported IETF language codes. The list is available here. The code is case insensitive.
options.originalPosition
Boolean
default:None

Determines if the service should include the original incidents' position.


Return the original position of the incident (originalPosition attribute) as well as the one shifted to the beginning of the traffic tube.
options.preserveCluster
Boolean
default:None

Determines if the service should keep the clusters data.


Tells the service to keep all traffic incidents separately clustered when receiving a list of all traffic incidents in a cluster. This gets all the incidents details while remaining in clusters.
options.protocol
"http" | "https"
default:"https"

The protocol type to be used in the calls.


Represents the type of protocol used to perform a service call.
options.style
String
default:None

Style name, needs to be one of 's1', 's2', 's3', 'night'. This needs to match the style of your raster traffic tiles to match traffic tubes with traffic icons.


The style that will be used to render the traffic tile in the Maps API. This will have an effect on the coordinates of traffic incidents in the reply.
options.trafficModelID
Number
default:None

A valid, not older than two minutes, traffic model ID.


Number referencing the traffic model to use. This can be obtained from the IncidentViewport service. It is updated every minute, and is valid for two minutes before it times out. If a wrong Traffic Model ID is specified, the correct one will be returned by the interface. The default value of -1 will always invoke the most recent traffic model. Nevertheless, it is good practice to use the value obtained from the service as this will guarantee an alignment with the raster traffic layer.
options.zoomLevel
Number
default:None

Zoom level from 0 to 22


The zoom level of a currently displayed map. It is needed as the style (visibility, clustering, etc...) depends on the current zoom level.

Methods

go( ): Promise

Executes a predefined asynchronous task using the current configuration.

Returns