Maps SDK for Web

tt.services.incidentDetailsV5

Provides detailed information about traffic incidents in the requested area using the TomTom Traffic API - Traffic Incidents Details. This is a new version of the incidentDetails method with simpler options and a more readable response object.

The current road situation is updated every minute.

Response

The fields that appear in the response depend on the value of the fields request parameter.

The response is extended with getTrackingId() method, which returns the Tracking-ID associated with the request.

Constructor

tt.services.incidentDetailsV5(options, [additionalOptions])

Example
tt.services.incidentDetailsV5({
  key: '<Your API key>',
  boundingBox: '4.8854592519716675,52.36934334773164,4.897883244144765,52.37496348620152'
}).then(function(response) {
  console.log(response);
});
Parameters
Name Description
options
Object
default:None
Options object.
additionalOptions
Object
default:None
Additional options to be passed to the service.
additionalOptions.abortSignal
Object
default:None

Signal created with abortController.


Use AbortController to cancel requests in progress.
Example
var abortController = new AbortController();
var options = {};
tt.services.calculateRoute(options, { abortSignal: abortController.signal })
    .then(function(response) { console.log(response) });
    .catch(function(error) {
        if (abortController.signal.aborted === true) {
            console.log('Request aborted.');
        }
    });
abortController.abort();
options.boundingBox
Maps.LngLatBounds | 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. Maximum area of bounding box is 10000km2.
This option is able to convert a number of popular formats into the bounding box. The supported formats are listed below:
  • Maps.LngLatBounds class instance
  • {minLon: 0, minLat: 0, maxLon: 1, maxLat: 1} A plain object with the keys minLon, minLat, maxLon, maxLat.
  • [0, 0, 1, 1] An array of numbers describing the bounding box following the order: minLon, minLat, maxLon, maxLat.
  • [[0, 0], [1, 1]] A two-dimensional array with two indexes [southWest, northEast], each one with longitude and latitude values.
  • "0,0,1,1" A comma-separated string with numbers in the order: minLon, minLat, maxLon, maxLat.
  • [{lon: 0, lat: 0},{lon: 1, lat: 1}] A one-dimensional array with two objects in the order: southWest, northEast, and each object with a lat and lon key.
  • [{lng: 0, lat: 0},{lng: 1, lat: 1}] A one-dimensional array with two objects in the order: southWest, northEast and each object with a lat and lon key.
  • [Maps.LngLat, Maps.LngLat] A one-dimensional array with two Maps.LngLat instances in the order: southWest and northEast.
options.fields
String
default:'{ incidents { type, geometry { type, coordinates }, properties { iconCategory } } }'
The fields to be included in the response, nested as in the response schema. In order to obtain all data, it is necessary to place the whole object in the query.
`{
  incidents {
    type,
    geometry {
      type,
      coordinates
    },
    properties {
      id,
      iconCategory,
      magnitudeOfDelay,
      events {
        description,
        code,
        iconCategory
      },
      startTime,
      endTime,
      from,
      to,
      length,
      delay,
      roadNumbers,
      aci {
        probabilityOfOccurrence
        numberOfReports
        lastReportTime
      }
    }
  }
}`
options.key
String
default:None

A valid API Key for the requested service.


Key is required to make use of the given service. It can be issued in the Developer Portal.
options.language
String
default:'en-GB'

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


The ISO 639-1 code for the output language.
  • Affects the description field in the response.
  • When an invalid language code is provided the response is returned in English.
  • When an incident description does not have a translation, an English description is returned.
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.t
String
default:None

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


The Traffic Model ID is the reference value for the state of traffic at a particular time. It is updated every minute, and is valid for two minutes before it times out. If not provided the current traffic model ID is used.
options.trackingId
String
default:uuid

Sets value of "Tracking-ID" header.


Specifies an identifier for the request. If not set by the user, UUID is generated for each call.
  • It can be used to trace a call.
  • The value must match the regular expression '^[a-zA-Z0-9-]{1,100}$'.
  • An example of the format that matches this regular expression is UUID: (e.g. 9ac68072-c7a4-11e8-a8d5-f2801f1b9fd1). For details check RFC 4122.
  • If specified, it is replicated in the Tracking-ID Response header.
  • It is only meant to be used for support and does not involve tracking of you or your users in any form.