Traffic Flow - Protobuf
Request accessPurpose
The TomTom Traffic Flow - Intermediate Service - Protobuf (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.
This document describes the data exchange method and the payload description of the Service interface.
Scope
This document gives basic information on the Service and shows how to configure it to work with your environment. The user is expected to have basic installation knowledge and experience using protocol buffers.
Intended audience
This document is intended to be used by TomTom partners and customers (decision makers and developers).
Features
TomTom offers traffic flow data to customers. A custom product is configured based upon your specific needs. The product is static, so included regions and features are fixed (once the product is configured), it contains standard configuration and also provides customizable configuration options (see section Available features ).
Request data
The Service uses RESTful API (Representation State Transfer) technology. Since you only need to use one URL, the service is relatively uncomplicated to use. To make a request, the URL is 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.
https://{baseURL}/tsq/hdf-detailed/{productName}/{apiKey}/content.proto[?flowType={flowType}]The following is an example URL:
https://cert-traffic.tomtom.com/tsq/hdf-detailed/DEU/{Your_API_Key}/content.protoThe following is an example cURL request:
curl --compressed -XGET 'https://cert-traffic.tomtom.com/tsq/hdf-detailed/DEU/{Your_API_Key}/content.proto'Request parameters
The following table provides a detailed explanation of the available fields that were previously shown.
| Required parameters | Description |
|---|---|
| Base URL for calling the API. |
| 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), and the location referencing
method (see Location referencing ). |
| Authorization key for access to the API. |
| Optional parameters | Description |
|---|---|
| When the feed is requested without the parameter
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 free-flow data (that the user already has). The verification is done by confirming the |
Request headers
Since flow feeds can be very large, TomTom recommends optimizing the information transmission as much as possible. Through optimization, the client receives more up-to-date information.
| Headers | Description |
|---|---|
| If-Modified-Since | TomTom recommends using the standard HTTP header
|
Response data
Response codes
| Response code | Description |
|---|---|
| 200 OK | Indicates that the request has succeeded. The response body will contain the requested data. |
| 304 Not Modified | Only used if the |
| 401 Unauthorized | Indicates that the request requires user authentication information. The client MAY repeat the request with a suitable Authorization header field. |
| 406 Not Acceptable | The server doesn’t find any content that conforms with the |
Response example
If you make the following request:
https://cert-traffic.tomtom.com/tsq/hdf-detailed/DEU/{Your_API_Key}/content.proto?flowType=nffYou can expect a response that contains protocol buffers binary data. The textual representation of this data could look like this:
metaInformation { createTimeUTCSeconds: 1452092910 supplierAndClientInfo { clientID: "db14af1d-3827-4d61-8525-8f70bc1c5b3f15e87601" supplierID: "TomTom Traffic Service" }}[...]trafficFlow { location { openlr: "\013\t\223\332%UF\033`\013\001)\002$\033S~" } speed { averageSpeedKmph: 5 travelTimeSeconds: 334 confidence: 97 relativeSpeed: 0.106 trafficCondition: STATIONARY_TRAFFIC }}[...]Response - Protobuf payload specification (analysis of the received output)
Protocol buffers is the de-facto standard for encoding and transmitting any structured information in a compact, platform-independent way. TomTom uses protocol buffers (version 2) format for the output payload. After defining the data structure an encoder and a decoder can be generated for integration into C++, Java and several other languages. Also see http://code.google.com/p/protobuf or https://protobuf.dev for more information.
All fields are marked as optional, as recommended by Google, but the output always contains flow information (including a location).
The following table contains a brief description of the supported message types used in the data structure. More detailed information about the individual message fields can be found in the following sections: some fields are filled in by default, other fields require a specific feature to be enabled with the product.
| Protocol buffers message type | Description |
|---|---|
TrafficFlowGroup | The traffic flow group is the top-level message.
It provides meta data (see |
MetaInformation | The meta information message provides data shared by all traffic flow messages. |
SupplierAndClientInfo | The supplier and client information message identifies the client and the supplier. |
TrafficFlow | The traffic flow message assigns speed information to a location. It may also identify road blockages. |
TrafficFlowWithPredictionPerSection | This message assigns current and future speed information to sections of a location at several points in time. |
Speed | The speed message subsumes all speed and travel time related information. Which fields are set depends on the customizable product configurations (see the section Available features ). |
SectionSpeed | The |
SpeedVector |
|
Location referencing
OpenLR
Geographical representation of the road segments is an important part of the payload. The following geographical representations that are supported:
- by default OpenLR location referencing is used,
- optionally Identifier-based location referencing based on OSM way IDs , or
- optionally Identifier-based location referencing based on GERS IDs can be provided.
OpenLR is a dynamic location referencing method that allows referencing of any road on the complete digital map. Because of its flexibility, it is possible to describe traffic events on high-level and lower-level road classes that are usually not covered by TMC. The method is available free of charge. The service uses binary format version 3, as described in the OpenLR whitepaper. The whitepaper, software developer kit, and open source reference implementations are available for download from the OpenLR website . TomTom offers support for third parties to implement and test their own implementations.
location { openlr: "\v\254\320.!\367\n\033l\a\000Z\376\223\033\000" lengthInMeters: 425}Identifier-based location referencing using OSM way IDs
Identifier-based location referencing OSM way IDs (hereafter called ‘IDLR-OSM’) is offered as an alternative method of location referencing besides OpenLR and Identifier-based location referencing using GERS IDs . It is not enabled by default and can be enabled upon request.
The following example shows a trafficFlow message with an IDLR-OSM in the segmentIds field indicated
by type: OSM_WAY_ID that is composed of six OSM way IDs. All IDs use the forward direction, the first ID uses a start-offset,
the second through fifth IDs have no offsets, and the sixth ID uses an end-offset.
The affected location is the concatenation of all IDs minus the offset information.
trafficFlow { location { openlr: "\v\211\302\310.P\211\033n\36418\324\253\033r\344\360I\324\036\033m\350>W\331\341\033l\3572Y\333t\033y\377\344" lengthInMeters: 28533 segmentIds { type: OSM_WAY_ID segmentId { id: 230910249 backwards: false startOffsetInMeters: 3031 } segmentId { id: 631550315 backwards: false }12 collapsed lines
segmentId { id: 631550313 backwards: false } segmentId { id: 406702546 backwards: false } segmentId { id: 406702549 backwards: false } segmentId { id: 406702547 backwards: false endOffsetInMeters: 11317 } } } speed { averageSpeedKmph: 65 travelTimeSeconds: 1580 confidence: 100 }}Identifier-based location referencing using GERS IDs
Identifier-based location referencing Global Entity Reference System (hereafter called ‘IDLR-GERS’) is offered as an alternative method of location referencing besides OpenLR and IDLR-OSM . It is not enabled by default and can be enabled upon request.
The following example shows a trafficFlow message with an IDLR-GERS in the segmentIds field indicated
by type: GERS_ID that is composed of five GERS IDs. All IDs use the backwards direction, the first ID uses a start-offset,
the second through fourth IDs have no offsets, and the fifth ID uses an end-offset.
The affected location is the concatenation of all IDs minus the offset information.
trafficFlow { location { openlr: "\v\004\'|#U\0203\345C\001}\374\216#ffZ" lengthInMeters: 979 segmentIds { type: GERS_ID segmentId { id: 319719336117268785 backwards: false startOffsetInMeters: 1594 idHigh: 604038967628660735 } segmentId { id: 319712699939139853 backwards: false idHigh: 613046166810001407 }10 collapsed lines
segmentId { id: 323919439968428109 backwards: false idHigh: 617549766435536895 } segmentId { id: 319695982581605327 backwards: false idHigh: 613046166810001407 } segmentId { id: 319411736432914706 backwards: false endOffsetInMeters: 1398 idHigh: 604038967628660735 } } } speed { averageSpeedKmph: 38 travelTimeSeconds: 93 confidence: 100 }}Note that a 128-bit GERS ID is composed of two 64-bit values represented by the fields id and idHigh.
The field idHigh contains the most significant bits, while id contains the least significant bits.
The following pseudocode illustrates how these fields should be combined.
gers_id = (idHigh << 64) | idAvailable features
This section describes the available features of the Service. Some features are enabled by default, while others are optional and can be enabled upon request.
Dynamic sectioning
| Availability | This feature is enabled by default. |
|---|---|
| Description | Dynamic sectioning describes the flow segments in smaller sections when
conditions vary considerably within a longer road stretch.
The Service uses the message type Note that this feature is also available for the flow message type |
trafficFlow { location { openlr: "\v\254\320.!\367\n\033l\a\000Z\376\223\033\000" lengthInMeters: 425 } speed { averageSpeedKmph: 11 travelTimeSeconds: 144 confidence: 81 } sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 2 travelTimeSeconds: 115 confidence: 81 } } sectionSpeed { startOffsetInMeters: 48 speed { averageSpeedKmph: 46 travelTimeSeconds: 29 confidence: 81 } }}Flow prediction
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | Flow prediction uses the message type |
trafficFlowWithPredictionPerSection {4 collapsed lines
location { openlr: "\013\265\215\373\034\271\032\022V\031\371\033\000\031\022\010" lengthInMeters: 1518 } speedVector { minutesInFuture: 0 sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 10 travelTimeSeconds: 238 } } sectionSpeed { startOffsetInMeters: 673 speed { averageSpeedKmph: 48 travelTimeSeconds: 63 } } } speedVector { minutesInFuture: 1514 collapsed lines
sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 10 travelTimeSeconds: 240 } } sectionSpeed { startOffsetInMeters: 673 speed { averageSpeedKmph: 48 travelTimeSeconds: 63 } } } speedVector { minutesInFuture: 3014 collapsed lines
sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 31 travelTimeSeconds: 77 } } sectionSpeed { startOffsetInMeters: 673 speed { averageSpeedKmph: 51 travelTimeSeconds: 60 } } } speedVector { minutesInFuture: 4514 collapsed lines
sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 31 travelTimeSeconds: 78 } } sectionSpeed { startOffsetInMeters: 673 speed { averageSpeedKmph: 51 travelTimeSeconds: 60 } } }}HOV Flow
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | Adds separate speed entries for lanes reserved for high-occupancy
vehicles, for now only the current speed for the whole location is
available. The following example shows Note that this feature is also available for the flow message type |
trafficFlow { location { openlr: "\v\251\003-!\331\326\001\f!\002K\371\264\001\037" lengthInMeters: 1939 } speed { averageSpeedKmph: 76 travelTimeSeconds: 92 confidence: 100 } speed { averageSpeedKmph: 90 travelTimeSeconds: 78 confidence: 100 speedCondition { laneType: HIGH_OCCUPANCY } }Map version
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | Provides name and version of the map that was used to create the content.
The map version is reported with the Note that this feature is also available in snapshots with the flow message type |
metaInformation { createTimeUTCSeconds: 1696833480 supplierAndClientInfo { clientID: "5b5977db-ab96-4599-b079-314a09cb9f204045d8f9" supplierID: "TomTom Traffic Service" } mapVersion: "nam2023.06.060"}trafficFlow {10 collapsed lines
location { openlr: "\v\215\332\024\'V\'\033e!\b\034\003\357\023B\034\004\311\005\005\023B\001\000O\000G\023D\003\001\004\000\223\023C\001\000E\000B\023\341#\371\025\375\022?\"\b" lengthInMeters: 6125 } speed { averageSpeedKmph: 43 travelTimeSeconds: 513 confidence: 100 relativeSpeed: 1.0 trafficCondition: FREE_TRAFFIC }}Meta information & supplier and client information
| Availability | This feature is enabled by default. |
|---|---|
| Description | The
|
metaInformation { createTimeUTCSeconds: 1696832700 supplierAndClientInfo { clientID: "5b5977db-ab96-4599-b079-314a09cb9f204045d8f9" supplierID: "TomTom Traffic Service" }}Relative speed
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | When enabled, the relative speed to the free-flowing speed is given as a
ratio (e.g., 0.250 indicates a current real-time speed that is 25% of
free flow speed) in field Note that this feature is also available for the flow message type |
trafficFlow { location { openlr: "\013\265f\361\034J\374\001\0349\363A\006\013\001\014" } speed { averageSpeedKmph: 23 travelTimeSeconds: 534 confidence: 99 relativeSpeed: 0.229 }}Speed message default information
| Availability | This feature is enabled by default. |
|---|---|
| Description | The
Note that the same default information is provided in |
trafficFlow {4 collapsed lines
location { openlr: "\v\254\320.!\367\n\033l\a\000Z\376\223\033\000" lengthInMeters: 425 } speed { averageSpeedKmph: 11 travelTimeSeconds: 144 confidence: 81 }}Time to usual
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | Provides the time duration (in minutes) for the average speed (of the
entire location) of a flow message to return to the usual speed (speed
profile). This feature is only available for flow message types
|
trafficFlowWithPredictionPerSection {45 collapsed lines
location { openlr: "\v\n\031\\&\0032\v(\n\003q\377x\v\030" lengthInMeters: 622 } speedVector { minutesInFuture: 0 sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 13 travelTimeSeconds: 179 confidence: 100 } } } speedVector { minutesInFuture: 15 sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 13 travelTimeSeconds: 179 } } } speedVector { minutesInFuture: 30 sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 49 travelTimeSeconds: 46 } } } speedVector { minutesInFuture: 45 sectionSpeed { startOffsetInMeters: 0 speed { averageSpeedKmph: 49 travelTimeSeconds: 46 } } } timeToUsualInMinutes: 26}Traffic condition
| Availability | This feature is optional and can be enabled upon request. |
|---|---|
| Description | Provides a textual traffic condition indicator. When enabled, a categorization of current traffic condition is given. It can be any value out of seven values (see more details on FAQ about the definition of traffic conditions ):
Note that this feature is also available for the flow message type |
trafficFlow { location { openlr: "\013\265f\361\034J\374\001\0349\363A\006\013\001\014" } speed { averageSpeedKmph: 23 travelTimeSeconds: 534 confidence: 99 trafficCondition: STATIONARY_TRAFFIC }}