Vector Flow Tiles
Purpose
The Traffic API Vector Flow Tiles endpoint provides data on zoom levels ranging from 0 to 22.
- For zoom level
0, the world is displayed on a single tile. - At zoom level
22, the world is divided into 244 tiles. See the Zoom Levels and Tile Grid .
The service delivers traffic flow data packaged in a vector representation of squared sections called vector tiles.
- Each tile includes a pre-defined collection of road shapes with traffic flow data.
- The format of the tile is formally described using the protobuf schema .
It can show both the current speed of traffic on different road segments, and the difference between current speed and the free-flow speed on the road segment.
Tiles resolution
Road geometry is stored as coordinates in the range of 0-4095. Coordinates (0,0) define the top-left corner of the tile.
Vector format
The Vector format is a binary format created by using Google Protocol Buffers to serialize the data according to this defined vector schema .
- The data is mapped to a protobuf layer called “Traffic flow”.
- Besides the protobuf layers, the protobuf tags are also used to further describe the traffic.
- The protobuf tags are split into two categories: default and on-demand.
- The default tags are used unless they are filtered out by the
tagsrequest parameter. - The on-demand tags are used only if they were added by the
tagsrequest parameter.
- The default tags are used unless they are filtered out by the
Currently, the following Traffic flow tags are used.
Default tags
| Tag | Description |
|---|---|
| The tag value describes the road category.
|
| The tag presence indicates if the road has a subcategory.
Not all road categories have subcategories.
|
| The tag value indicates the speed relative to free-flow traffic. |
| The tag presence indicates if the road has left-hand traffic.
If the tag is not present the road has right-hand traffic. |
| The tag presence indicates if the road is closed to traffic.
If the tag is not present the road is not closed and is passable. |
On-demand tags
| Tag | Description |
|---|---|
| The tag value indicates the absolute speed in kmph (kilometers per hour). |
| The tag presence indicates if the traffic is part of a two-way road (two different geometries, each with a value for one side). If the tag is not present, the flow covers the whole one-way road. |
| The OpenLR code describing the flow section. |
| The tag value represents the ranking of the road based on its importance and relevance. It can be used for filtering.
Allowed values: |
Request data
HTTPS method: GET
- 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}/maps/orbis/traffic/tile/flow/{zoom}/{x}/{y}.{format}?apiVersion=1&key={Your_API_Key}https://api.tomtom.com/maps/orbis/traffic/tile/flow/5/4/8.pbf?apiVersion=1&key={Your_API_Key}curl 'https://api.tomtom.com/maps/orbis/traffic//tile/flow/5/4/8.pbf?apiVersion=1&key={Your_API_Key}'Request parameters
These elements are used in calls to generate all vector tile layers.
- Required parameters must be used or the call will fail.
- Parameters and values are case-sensitive.
- Optional parameters may be used.
| Required parameters | Description |
|---|---|
| The base URL for calling TomTom services. |
| The zoom level of a tile to be rendered. |
| The x coordinate of a tile on the zoom grid. |
| The y coordinate of a tile on the zoom grid. |
| The format of the response. |
| An API Key valid for the requested service. |
| Optional parameters | Description |
|---|---|
| This filter allows the choice of types of road
categories to be included in the response. The filter
narrows down the road categories available at a
particular zoom level. Multiple values are supported
and should be separated by a comma.
|
| The list of the values representing the available tags in the tile.
By default, only the default tags are attached to the tile geometry. See Vector format for details.
Value: Comma-separated list. |
| Contains a version of the API to call. |
Request headers
| Required headers | Description |
|---|---|
| TomTom-Api-Version | Contains a version of the API to call. |
| Optional headers | Description |
|---|---|
| Accept-Encoding | Contains the content encoding (usually a compression algorithm),
that the client is able to understand. |
| If-None-Match | Contains an identifier for a specific version of a resource. The server
will send back the requested resource with a 200 HTTP status code, only
if it doesn’t have an ETag matching the given one. |
| Tracking-ID | Specifies an identifier for the request.
Value: |
Response data
Successful response
The Traffic Vector Flow Tiles API endpoint, for a single request, returns a binary response body which must be deserialized by client code generated by the Google Protocol Buffers compiler.
The following examples use a simple textual representation of the serialized binary vector tile data to illustrate the response content.
https://api.tomtom.com/maps/orbis/traffic/tile/flow/17/64989/42178.pbf?apiVersion=1&key={Your_API_Key}layer: 0 name: Traffic flow version: 2 extent: 4096 feature: 0 id: (none) geomtype: linestring geometry: LINESTRING[count=3](3002 -409,2964 1292,2842 2382) LINESTRING[count=3](2842 2382,2964 1292,3002 -409) properties: road_category="primary" [string] realtive_speed=0 [double] left_hand_traffic=1 [bool] feature: 1 id: (none) geomtype: linestring geometry: LINESTRING[count=8](-409 656,-108 810,1260 1620,1832 1914,2842 2382,3792 2644,4400 2770,4505 2783) properties: road_category="primary" [string] relative_speed=0.7 [double] left_hand_traffic=1 [bool] feature: 2 id: (none) geomtype: linestring geometry: LINESTRING[count=10](4505 2766,4418 2752,3882 2660,3406 2552,2920 2430,2700 2308,2276 2114,1952 1958,940 1430,-409 648) properties: road_category="secondary" [string] relative_speed=0.77 [double] left_hand_traffic=1 [bool] feature: 3 id: (none) geomtype: linestring geometry: LINESTRING[count=7](2842 2382,2806 2752,2826 2932,3062 3494,3528 3882,4122 4366,4222 4505) LINESTRING[count=7](4222 4505,4122 4366,3528 3882,3062 3494,2826 2932,2806 2752,2842 2382) properties: road_category="primary" [string] relative_speed=1 [double] left_hand_traffic=1 [bool]Error response
The Traffic Vector Flow Tiles API endpoint for an invalid single request returns a response body in JSON format.
Error response field structure
| Field | Description |
|---|---|
| Main object of the error response. |
| One of a server-defined set of error codes. |
| A human-readable description of the error code. |
{ "detailedError": { "code": "INVALID_REQUEST", "message": "Invalid zoom value. Allowed values are <0,22>." }}Response codes
| Code | Meaning & possible causes |
|---|---|
200 | OK |
400 | Bad request:
|
403 | Forbidden: The supplied API Key is not valid for this request. |
405 | Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource. |
429 | Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key. |
500 | Internal Server Error: There is a problem with the TomTom Traffic Vector Flow Tiles API endpoint. |
503 | Service currently unavailable |
596 | Service Not Found: Unknown version of the service. |
Response headers
The following table lists HTTP response headers of particular interest to clients of the Traffic API Vector Flow Tiles endpoint.
| Header | Description |
|---|---|
| Access-Control-Allow-Origin | Indicates that cross-origin resource sharing (CORS) is allowed. |
| Allow | Lists the set of supported HTTP methods. The header is sent in case a |
| Cache-Control | Contains directives for a caching mechanism. Value: |
| Content-Encoding | Indicates which encodings were applied to the response body. |
| Content-Length | Contains information about the size of the response body. |
| Content-Type | Indicates the media type of the resource returned. |
| Date | Contains the date and time when the message was originated. |
| ETag | Contains an identifier for a specific version of resource. |
| Tracking-ID | An identifier for the request. If the Tracking-ID
header was specified in the request, it is replicated in the response.
Otherwise, it is generated automatically by the service. For details
check RFC 4122 .I t is only meant to
be used for support and does not involve tracking of you or your users
in any form. |