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 | Number[] | Object[] | String default:None |
Bounding box area in one of the supported formats. The bounding box is a limited area within the search results. If it is omitted then the whole world will be taken into consideration. In case the area specified exceeds the world boundaries, the following actions will be taken depending on which side was exceeded:
|
options.expandCluster
Boolean default:false |
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. Note that when this is set to false, the toGeoJson() method available in the resolved response will return only unclustered POIs, but no clusters. |
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 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:false |
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:false |
Determines if clustered incidents data should be available in the cluster feature. If this is set to true, the toGeoJson() method available in the resolved response will return features with an additional properties.features
field containing clustered features.
Note that this option only works in conjunction with expandCluster set to true .
|
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 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