Traffic Flow - DatexII

Last edit: 2024.08.09
TomTom Maps

Purpose

The TomTom Traffic Flow – Intermediate Service – DATEX II (hereafter called 'Service') is designed for server to server integration with traffic control center, routing, navigation, and mapping applications. It contains real-time travel times and speeds for segments based on TomTom's Traffic technology with several possible configurations.

In this document, we discuss how to access the service endpoint and the features that are included. TomTom only supports the Intermediate Service with the use of the TomTom customized DATEX II schema , available for download from our website (linked previously and later in this document). Using the Service with the standard DATEX II schema will disable the functionality that is included with the Service. Therefore, the standard DATEX II schema is not supported.

Scope

This page gives basic information on the Service and shows you how to configure this to work with your environment. Basic knowledge of installing and using XML-based schemas is necessary.

Intended audience

This information is intended to be used by TomTom partners and customers (decision makers and developers).

Standard configurations

TomTom offers traffic flow data to customers. The most basic data type is speed information and travel times, by segment. TomTom configures a custom product based upon your specific needs. The product is static, so included regions and features are fixed once the product is configured.

Optional configurations

The Service gives users traffic flow data with highly customizable configuration options. When the product is configured, there are some additional options that could be enabled, depending on your specific preferences.

OptionDescription
Relative speed

When enabled, the relative speed is provided. This is defined as the ratio of average speed to free-flowing speed (for example, 0.250 indicates a current real-time speed that is 25% of freeflow speed).

Traffic condition

When enabled, the current traffic condition is given. This is expressed by one of up to seven available values, for example, heavyTraffic or stationaryTraffic.

Miles per hour

The average speed is additionally provided in mph (all speeds are provided by default in km/h).

Map version

Provides names and versions of the maps that were used to create the content.

Request data

The Service uses RESTful API (Representation State Transfer) technology. Because you only need to use one URL, the endpoint is simple to use.

'Simple HTTP server' profile

The interface supports the client pull method, also known as the simple HTTP server profile. The profile is described in the Software Developers Guide and Exchange Platform Specific Model (see the DATEX II payload specification for the links to the documents). TomTom does not support the SOAP envelope, as described in the Software Developers Guide.

Important

To use this service, ensure that all prerequisites are met as described in the section A secure connection or at Authentication for client certificate access.

How do you make a request?

To make a request, the URL should be constructed as shown in the following sections.

HTTPS Method: GET

For ease of viewing and identification:

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

The sample URL is formatted as follows:

get
URL request format
https://{baseURL}/tsq/hdf/{productName}/{apiKey}/content.xml[?flowType={flowType}]

The following is an example URL request:

get
URL request example
https://cert-traffic.tomtom.com/tsq/hdf/DEU-HDF-OPENLR/{Your_API_Key}/content.xml

The following is an example cURL request:

get
cURL request example
curl -XGET 'https://cert-traffic.tomtom.com/tsq/hdf/DEU-HDF-OPENLR/{Your_API_Key}/content.xml'

Request parameters

The following table provides a detailed explanation of the available fields that were previously shown in the HTTPS Method: GET section.

Required parametersDescription

baseURL
string

Base URL for calling the API.
Value: cert-traffic.tomtom.com

productName
string

Name of the product (feed) you are requesting. These will be indicated to you as part of the provisioning process. Typically, it explains the country (country code), type of feed (HDF is the flow feed) and the location referencing method (TMC or OpenLR).
Value: e.g., DEU-HDF-TMC, DEU-HDF-OPENLR

apiKey
string

Authorization key for access to the API.
Value: Your valid API key.

Optional parameters

Description

flowType
string

When the feed is requested without the parameter flowType it contains ALL messages covered by the feed. In that case, the field averageSpeed in a message represents the current speed for congested road segments and the free-flow speed for non-congested road segments. By using the flowType parameter, the response can be shaped to only support a certain speed type. This also affects the number of messages in the response.


There are two values supported for this parameter:

  • ff, gets the messages for ALL road segments covered by the feed. The field averageSpeed in the message provides the free-flow speed for the affected road segment.

  • nff, only gets the messages for road segments that are NOT in a free-flow state. The field averageSpeed of a message provides the currently measured speed for the affected road segment.


When using this parameter, at the first request the free-flow information should be downloaded. Afterwards, non-free-flow information can be downloaded for each future request. The free-flow and non-free-flow data are related. The segments for both files should be in sync, otherwise there is a mismatch in the locations of the free-flow data.

Therefore, every time the non-free-flow information is downloaded, it must be checked. This insures that the non-free-flow data corresponds to the freeflow data (that the user already has). The verification is done by confirming the nationalIndentifier within publicationCreator in DATEX II format.

If the nationalIndentifier of the non-free-flow content does not match the nationalIndentifier of the free-flow content that was downloaded with the first request, the free-flow information must be re-requested. See more details on FAQ about speeds in non free flow feed.
Value: flowType=nff, flowType=ff

HTTP headers

Since flow feeds can be very large, TomTom recommends optimizing the information transmission as much as possible. By doing this, the client receives more up-to-date information.

HeadersDescription
If-Modified-Since

TomTom recommends using the standard HTTP header If-Modified-Since with the last value of Last-Modified received. When this header is used properly, you avoid unnecessarily downloading identical content. For details, see the HTTP/1.1 standard (RFC2616 section 14.25).
Value: Example: Wed, 21 Oct 2015 07:28:00 GMT

Accept-Encoding

The TomTom Traffic Incidents bulk feed supports gzip compression of all response types. However, responses are compressed only when the requester states gzip support. This should be specified through the standard HTTP header Accept-Encoding. TomTom recommends using this header type as it significantly reduces the payload size.
Value: gzip

Response data

Response example

This is the response you receive after a request is made. If you make the following request:

get
URL request example
https://cert-traffic.tomtom.com/tsq/hdf/DEU-HDF-OPENLR/<APIKEY>/content.xml?flowType=nff

You can expect the following response:

Response example - XML
1<?xml version="1.0"?>
2<d2LogicalModel xmlns="http://datex2.eu/schema/1_0/1_0" modelBaseVersion="1.0">
3 <exchange>
4 <supplierIdentification>
5 <country>nl</country>
6 <nationalIdentifier>TomTom Traffic Service</nationalIdentifier>
7 </supplierIdentification>
8 </exchange>
9 <payloadPublication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10 xsi:type="ElaboratedDataPublication" lang="en">
11 <publicationTime>2015-12-23T11:54:00Z</publicationTime>
12 <publicationCreator>
13 <country>other</country>
14 <nationalIdentifier>db14af1d-3827-4d61-8525-8f70bc1c5b3f15e87601</nationalIdentifier>
15 </publicationCreator>
16 <headerInformation>
17 <confidentiality>internalUse</confidentiality>
18 <informationStatus>real</informationStatus>
19 </headerInformation>
20 <referenceSettings>
21 <locationSetReference/>
22 </referenceSettings>
23 <elaboratedData id="Ob719eb226ba9b25e44b15b17">
24 <basicDataValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TravelTimeValue">
25 <supplierCalculatedDataQuality>95.0</supplierCalculatedDataQuality>
26 <affectedLocation>
27 <locationContainedInGroup xsi:type="LocationByReference">
28 <locationExtension>
29 <openlr>
30 <binary>CwcZ6yJrqQslDgRLAQULFw==</binary>
31 </openlr>
32 </locationExtension>
33 <predefinedLocationReference>OpenLR</predefinedLocationReference>
34 </locationContainedInGroup>
35 </affectedLocation>
36 <travelTime>346.0</travelTime>
37 <travelTimeValueExtension>
38 <averageSpeed>9.0</averageSpeed>
39 <relativeSpeed>0.257</relativeSpeed>
40 <trafficCondition>queuingTraffic</trafficCondition>
41 </travelTimeValueExtension>
42 </basicDataValue>
43 </elaboratedData>
44 [...]
45 </payloadPublication>
46</d2LogicalModel>

Response – DATEX II payload specification (analysis of the output received)

The payload in the output is formatted as DATEX II, which is a European standard for the exchange of Traffic and Travel Information. TomTom supports version 1. Recommended documents are:

The Elaborated Data Publication, used by TomTom, is described in more detail in section 4.11 of the DATEX II User Guide version 1.0.

Important: XSD schema

TomTom extended the data model with additional fields; the full XSD schema including extensions can be downloaded by clicking this Level B extension. It is a "Level B" extension of the standard XML schema: DATEXIISchema_1_0_1_0.xsd. Such an extension is interoperable with the "Level A" data model (see section 2.2.3 in the DATEX II User Guide version 1.0 for more information).

Standard information

The following table shows the fields offered in our standard configuration. The features are standard DATEX II elements and TomTom specific extensions. For our purposes, 'congestion' is defined as traffic that may cause a non-freeflow condition.

Field Name (part of)Description

affectedLocation (TravelTimeValue)

The definition of a segment of a road in a particular direction. The segment identifier. See the Geographical representation.

travelTime (TravelTimeValue)

Current average travel time in seconds based on real-time measurements on the affectedLocation. Only provided in case of congestion. See TravelTime and averageSpeed.

averageSpeed (TravelTimeValueExtensionType)

Current average speed on the affectedLocation, in km/h, directly based on the travelTime and the length of the affectedLocation. Only provided in case of congestion; it is an extension of TravelTimeValue. See TravelTime and averageSpeed.

freeFlowTravelTime (TravelTimeValue)

The travel time in seconds that is expected under ideal freeflow conditions. Only provided in case of free flow conditions. See Freeflow, FreeFlowTravelTim, and freeFlowSpeed.

freeFlowSpeed (TravelTimeValue)

The freeflow speed in km/h that is expected under ideal freeflow conditions, corresponding to the freeFlowTravelTime. Only provided in case of freeflow conditions. See Freeflow, freeFlowTravelTime, and freeFlowSpeed.

supplierCalculatedDataQuality (BasicDataValue)

A measure of data quality assigned to the value by the supplier. 100% equates to perfect quality. See SupplierCalculatedDataQuality.

Freeflow

For every segment, an estimate is made whether traffic is flowing freely or whether it is congested. If traffic is flowing freely, the actual travel time depends on the type of vehicle and the speed driven. The actual speeds on each segment can differ greatly. In this case, the TravelTimeValue will contain the freeFlowSpeed and freeFlowTravelTime. If traffic is not flowing freely, it is considered congested, and a driver cannot choose the speed anymore. In that case, the TravelTimeValue will contain the travelTime and averageSpeed.

TravelTime and averageSpeed

The <travelTime> contains an estimate of the real-time travel time between the start and the end of the affected location. It is the instantaneous travel time, which means that it is the sum of the travel time estimations on the individual road segments of the affected location. Note that this may differ from the actual travel time, when measured from the start to the end of the affected location (especially for longer segments).

The reason for this difference is because the travel time estimate is based on both real-time measurements and historic data. It provides speeds by the day of the week and the time of day. The averageSpeed is directly derived from the provided travelTime and the length of the affectedLocation. Therefore, the supplierCalculatedDataQuality also applies to this value.

If the affected location is closed, the averageSpeed is set to 0 km/h and the travelTime refers to the travel time under freeflow conditions.

FreeFlowTravelTime and freeFlowSpeed

The freeFlowTravelTime is directly derived from the freeFlowSpeed and the length of the affectedLocation. The freeFlowSpeed is the expected speed under freeflow conditions, based on historic data. It is averaged over different vehicle types. The value is capped by the speed limit.

SupplierCalculatedDataQuality

This field contains a quality measure for the provided travel time and speed. It is based on the following variables:

  • The number of real-time measurements from devices driving the affected locations at the moment.
  • The standard deviation of the measurements.
  • The percentage of the affected location that is covered with measurements.
  • Compatibility of measurements with historic data.
  • The age of the measurements.

When we determine that an insufficient amount of real-time measurements are available, historic data is given a greater weight in the travel time estimate. If the value of supplierCalculatedDataQualityis below 60% (0.6), then the historic data holds greater importance in the calculation. A value of 50% (0.5) implies that the provided travel time is based only on the historic speed profile.

Optional information

The DATEX II data model has been extended to allow additional parameters. The service endpoint has the following possible extensions. Additional details are shown in Optional.

OptionImplementation
Miles per hourAverage speed in miles per hour. This feature is represented by the element averageSpeedInMPH provided in the complex type TravelTimeValueExtensionType.
Relative speedThe relative speed is the relationship between the average speed and the freeflow speed. The range is from 0 to 1 and is precise to three decimal places. If the ,relativeSpeed value is 0 , the actual average speed is 0. If the relativeSpeed value is 1 , then the average speed and freeflow speed are equal. This feature is represented by the element relativeSpeed provided in the complex type TravelTimeValueExtensionType. This field is only provided in case of congestion.
Traffic condition

Traffic status according to the relative speed of the location. It is represented by the element trafficCondition provided in the complex type TravelTimeValueExtensionType and it can be any of the following values (see more details on FAQ about the definition of traffic conditions):

  • freeTraffic
  • heavyTraffic
  • slowTraffic
  • queuingTraffic
  • stationaryTraffic
  • closed
  • unknown
Map version

This feature is supported by element mapVersion in complex type PayloadPublicationExtensionType.
Example:

1 <?xml version="1.0" ?>
2 <d2LogicalModel
3 xmlns="http://datex2.eu/schema/1_0/1_0"
4 modelBaseVersion="1.0">
5 [...]
6 <payloadPublication
7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8 xsi:type="ElaboratedDataPublication" lang="en">
9 [...]
10 <payloadPublicationExtension>
11 <mapVersion>eur2018.06</mapVersion>
12 </payloadPublicationExtension>
13 <!-- list of elaborated data elements follows -->
14 [...]
15 </payloadPublication>
16 </d2LogicalModel>

Geographical representation

Geographical representation of the road segments is an important part of the payload. There are two geographical representations that are supported: TMC and OpenLR. Since OpenLR prevents interpretation differences, licensing costs, map dependencies, or version dependencies, TomTom recommends using OpenLR instead of TMC. TMC based data is still offered for customers with existing platforms that need compatibility with their legacy systems.

The data type of the affectedLocation in the schema is a Group of Locations. LocationByReference is the location method used, and it contains the identifier of a predefinedLocationReference. If we use TMC, the predefinedLocationReference is a TMC link identifier. If we use OpenLR, the actual location reference information is provided in TomTom’s proprietary extension LocationExtensionType and the predefinedLocationReference is constantly set to “OpenLR.”

Location referencing methodExample
OpenLR
1<affectedLocation>
2 <locationContainedInGroup xsi:type="LocationByReference">
3 <locationExtension>
4 <openlr>
5 <binary>CwANeSUjyAENIAFw+aQBAA==</binary>
6 </openlr>
7 </locationExtension>
8 <predefinedLocationReference>OpenLR</predefinedLocationReference>
9 </locationContainedInGroup>
10</affectedLocation>
TMC
1<affectedLocation>
2 <locationContainedInGroup xsi:type="LocationByReference">
3 <predefinedLocationReference>LD01p27442</predefinedLocationReference>
4 </locationContainedInGroup>
5</affectedLocation>

OpenLR is an open source location referencing system for all roads. OpenLR is a dynamic location reference method that can reference the complete digital map. The location references use the binary format version 3 that is described in the OpenLR White Paper. An open source reference implementation can be downloaded on the OpenLR website (www.openlr.org). TomTom also offers support for third parties to implement and test their own implementation.

Traffic Message Channel (TMC)

When using TMC as a geographical representation, travel times are measured by a TMC link. A TMC link is part of a TMC path. A TMC link is a sequence of road elements that starts at a TMC location, and ends at a next TMC location in the TMC table in the specified direction. You can recognize a TMC link by:

  • TMC table (CountryCode, LocationTableNumber, version).
  • A primary TMC location, defining the TMC point location at the end of the TMC link.
  • A direction, as defined by the TMC path.
  • An optional extent (the default value is 1).

Generally, the set of TMC link identifiers that can be used in an ElaboratedDataPublication is static. That means that in subsequent ElaboratedDataPublications, the same locations will be used. However, this is not always the situation. Sometimes, the set of the used TMC link identifiers can be changed. This occurs when a new TMC table is introduced.

referenceSettings

For TMC–based data, the referenceSettings contain a locationSetReference. Here, a reference is made to a specific version of a TMC location table. The format is: A + BB + "v" + C + "." + D, where:

  • A = the Country Code (hex format).
  • BB = the Location Table Number (2 digits).
  • C = the major version number (1 or 2 digits).
  • D = the minor version number (1 or 2 digits).

Example:

referenceSettings example - XML
1<referenceSettings>
2 <locationSetReference>D01v7.1</locationSetReference>
3</referenceSettings>

In TMC–based DATEXII, TMC chain information includes the following parts ACVVDLLLLL[xE[E]]:

PartDescription

A

Fixed letter 'L'

C

Hexadecimal country code as described in IEC 62106.

VV

TMC Location Table code

D

TMC direction of the chain (defined by the TMC path). For possible values, see TMC direction.

LLLLL

TMC point location code. If the number is not five digits long, zeros are added at the beginning until there are five digits.

[xE[E]]

Either empty, when extent = 1, or fixed letter 'x' followed by the extent (one or two digits).

Using the specified TMC table, the secondary location (start of the stretch) can be found from the primary location, the direction and the extent. C, VV and LLLLL correspond to the TMC Location Reference, which is a unique identifier for a TMC location.

TMC direction

The possible values for D infer the direction of travel (secondary to primary location) along the TMC path.

ValueDirection

p

Positive

n

Negative

Examples

In this section, we demonstrate how to resolve TMC link identifiers on the receiver side. Here, we map the definition of each of the fields within the link identifier, and provide guidance on using the extent to find the secondary location.

Example 1: L817n39984x2

Given the TMC location data:

  • Country code: 8
  • Location table number: 17
  • Direction from secondary to primary location: negative
  • Primary location ID: 39984
  • Extent: 2

Interpret the TMC location data to resolve the secondary location:

  1. Invert direction: negative → positive.
  2. Since the resolved direction is positive, follow the positive offset path for 39984 in TMC table for two extents.
  3. You will find the subsequent positive offsets are 39985 and 39986, hence, the resolved secondary location is 39986.

Example 2: LD01p27442

Given the TMC location data:

  • Country code: D
  • Location table number: 1
  • Direction from secondary to primary location: positive
  • Primary location ID: 27442
  • Extent: 1 (if the extent is not provided explicitly then it is 1)

Interpret the TMC location data to resolve the secondary location:

  1. Invert direction: positive → negative.
  2. Since the resolved direction is negative, follow the negative offset path for 27442 in the TMC table for one extent.
  3. You will find the subsequent negative offset is 30080.

Predefined Location Product

In DATEX II, a PredefinedLocationsPublication is used to predefine a set of locations, that can then be referred to in the elaboratedDataPublication. This allows for simplification of the elaborated data publication, where typically, the elaborated data is published for a fixed set of locations that is then published separately. However, since there is a straightforward relationship between the predefined location reference we use, and the corresponding TMC link, the Predefined Location Product is not published.