Flow Segment Data
Purpose
This service provides information about the speeds and travel times of the road fragment closest to the given coordinates. It is designed to work alongside the Flow Tiles to support clickable flow data visualizations. With this API, the client side can connect any place in the map with flow data on the closest road and present it to the user.
Run this endpoint
You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.
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 these values. The generic URL format is as follows.
URL format
https://{baseURL}/traffic/services/{versionNumber}/flowSegmentData/{style}/{zoom}/{format}?key={Your_API_Key}&point={point}&unit={unit}&thickness={thickness}&openLr={boolean}&jsonp={jsonp}
Example
https://api.tomtom.com/traffic/services/4/flowSegmentData/absolute/10/xml?key={Your_API_Key}&point=52.41072,4.84239
curl command format
curl 'https:/api.tomtom.com/traffic/services/4/flowSegmentData/absolute/10/xml?key={Your_API_Key}&point=52.41072,4.84239'
Request parameters
The following table describes the parameters that can be used in a request.
- 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 version of the service to call. |
| The style used with Raster Flow Tiles and Vector Flow Tiles. This has an
effect on the coordinates in the response.
|
| The zoom level.
When Flow Segment data is used together with the Traffic Flow service,
the |
| The content type of the response structure. If the content type is
|
| The authorization key for access to the API. |
| The coordinates of the point close to the road segment. They
must be comma-separated and calculated using
EPSG:4326 projection
(also known as WGS84 ). |
Optional parameters | Description |
---|---|
| The unit of speed. |
| The segment width multiplier. |
| Specifies if the response should include OpenLR code. |
| Specifies the callback method. Only used where the
|
Request headers
The following data table lists HTTP request headers of particular interest to clients of the Flow Segment Data API endpoint. Note: There are no required headers in this endpoint.
Optional headers | Description |
---|---|
Contains the content encoding (usually a compression algorithm), that
the client is able to understand. | |
Tracking-ID | Specifies an identifier for the request. It can be used to trace a call.
The value must match the regular expression
|
Response data
Successful response
The Flow Segment Data API endpoint for a valid single request returns a response in XML or JSON format.
XML response body example
An XSD schema is available for download. The XML response of the preceding sample request would look like this:
1<flowSegmentData xmlns="http://lbs.tomtom.com/services" version="traffic-service 2.0.004">2 <frc>FRC2</frc>3 <currentSpeed>41</currentSpeed>4 <freeFlowSpeed>70</freeFlowSpeed>5 <currentTravelTime>153</currentTravelTime>6 <freeFlowTravelTime>90</freeFlowTravelTime>7 <confidence>0.59</confidence>8 <roadClosure>true</roadClosure>9 <coordinates>10 <coordinate>11 <latitude>52.40476</latitude>12 <longitude>4.844318</longitude>13 </coordinate>14 <coordinate>15 <latitude>52.411312</latitude>16 <longitude>4.8299975</longitude>17 </coordinate>18 <coordinate>19 <latitude>52.415073</latitude>20 <longitude>4.827327</longitude>21 </coordinate>22 </coordinates>23</flowSegmentData>
1{2 "flowSegmentData": {3 "-xmlns": "http://lbs.tomtom.com/services",4 "-version": "traffic-service 2.0.004",5 "frc": "FRC2",6 "currentSpeed": 41,7 "freeFlowSpeed": 70,8 "currentTravelTime": 153,9 "freeFlowTravelTime": 90,10 "confidence": 0.59,11 "roadClosure": true,12 "coordinates": {13 "coordinate": [14 {15 "latitude": 52.40476,16 "longitude": 4.84431817 },18 {19 "latitude": 52.411312,20 "longitude": 4.829997521 },22 {23 "latitude": 52.415073,24 "longitude": 4.82732725 }26 ]27 }28 }29}
Successful response field structure
The following table describes XML or JSON element fields that can appear in a successful response. The types of the fields refer to a JSON response.
Field | Description |
---|---|
| Main response element. |
| F unctional R oad C lass. This indicates the road type:
|
| The current average speed at the selected |
| The free flow speed expected under ideal conditions, expressed in the
|
| Current travel time in seconds based on fused real-time measurements between the defined locations in the specified direction. |
| The travel time in seconds which would be expected under ideal free flow conditions. |
| The confidence is a measure of the quality of the provided travel time
and speed. A value ranges between |
| This includes the coordinates describing the shape of the segment. Coordinates are shifted from the road depending on the zoom level to support high quality visualization in every scale. |
| The OpenLR code for segment. |
| This indicates if the road is closed to traffic or not. |
Error response
The Flow Segment Data 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. |
1{2 "error": "Missing point parameter.",3 "httpStatusCode": 400,4 "detailedError": {5 "code": "INVALID_REQUEST",6 "message": "Missing point parameter."7 }8}
Response codes
Code | Meaning & possible causes |
---|---|
| OK |
| Bad request |
| Forbidden: The supplied API Key is not valid for this request. |
| Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource. |
| Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key. |
| Internal Server Error |
| Service currently unavailable: The service is currently unavailable. |
| Service Not Found: Unknown version of the service. |
Response headers
The following data table lists HTTP response headers of particular interest to clients of the Flow Segment Data API endpoint.
Header | Description |
---|---|
Indicates that cross-origin resource sharing (CORS) is allowed. | |
Lists the set of supported HTTP methods. The header is sent in case a
| |
Indicates which encodings were applied to the response body. | |
Contains directives for a caching mechanism. | |
Contains information about the size of the response body. | |
Indicates the media type of the resource returned.
| |
Contains the date and time when the message was originated. | |
Contains the date after which the response is considered outdated. | |
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. It is only meant to be used for support and does not involve tracking
of you or your users in any form. |