Sorry, you need to enable JavaScript to visit this website.

Flow Segment Data

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 layer of the Maps API 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.

Request

Format

http(s)://<baseURL>/traffic/services/<versionNumber>/flowSegmentData/<style>/<zoom>/<format>?key=<apiKey>&point=<point>[&unit=<unit>][&thickness=<thickness>][&openLr=<boolean>][&jsonp=<jsonp>]

Example

https://api.tomtom.com/traffic/services/4/flowSegmentData/absolute/10/xml?key=<apiKey>&point=52.41072,4.84239

Parameters

The table below describes all of the parameters that can be used in a request. Required parameters must be used or the call will fail. Optional parameters, which are highlighted with [square brackets], may be used. If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table.

Parameter Description Req'd? Type / Values Default Value
baseURL Base URL for calling TomTom services. Yes api.tomtom.com
versionNumber Version of the service to call. The current version is 4. Yes 4
style The type of flow data to be displayed on the tile. Yes
  • absolute
  • relative
  • relative-delay
zoom Zoom level. This will affect traffic incident coordinates to present both road sides separately. Yes 0..22
format The content type of the response structure.

If the content type is jsonp, a callback method can be specified at the end of the service call.

Yes
  • xml
  • json
  • jsonp
apiKey Authorization key for access to the API. Yes API Key
point Coordinates of the point close to the road segment. They have to be comma-separated and calculated using EPSG4326 projection. Yes String
[unit] Unit of speed. No
  • KMPH
  • MPH
KMPH
[thickness] Segment width multiplier. No 1..20 10
[openLr] Should response include OpenLR code? No boolean false
[jsonp] Specifies the callback method. Only used where contentType is jsonp. No String

Response

An XSD schema can be downloaded here. The XML response of the sample request above would look like this:

<flowSegmentData xmlns="http://lbs.tomtom.com/services" version="1.0.21-mascoma">
    <frc>FRC2</frc>
    <currentSpeed>41</currentSpeed>
    <freeFlowSpeed>70</freeFlowSpeed>
    <currentTravelTime>153</currentTravelTime>
    <freeFlowTravelTime>90</freeFlowTravelTime>
    <confidence>0.59</confidence>
    <coordinates>
        <coordinate>
            <latitude>52.40476</latitude>
            <longitude>4.844318</longitude>
        </coordinate>
        <coordinate>
            <latitude>52.411312</latitude>
            <longitude>4.8299975</longitude>
        </coordinate>
        <coordinate>
            <latitude>52.415073</latitude>
            <longitude>4.827327</longitude>
        </coordinate>
    </coordinates>
</flowSegmentData>

Response Structure

Field Description
<flowSegmentData> Main response element.
The attribute version indicates the software version that generated the response.
<frc> Functional Road Class. This indicates the road type:

  • 0: Motorway, freeway or other major road
  • 1: Major road, less important than a motorway.
  • 2: Other major road.
  • 3: Secondary road.
  • 4: Local connecting road.
  • 5: Local road of high importance.
  • 6: Local road.
<currentSpeed> The current average speed at the selected point, in the units requested. This is calculated from the currentTravelTime and the length of the selected segment.
<freeFlowSpeed> The free flow speed expected under ideal conditions, expressed in the units requested. This is related to the freeFlowTravelTime.
<currentTravelTime> Current travel time in seconds based on fused real-time measurements between the defined locations in the specified direction.
<freeFlowTravelTime> The travel time in seconds which would be expected under ideal free flow conditions.
<confidence> The confidence is a measure of the quality of the provided travel time and speed.
A value of 1 means full confidence, that the response contains the highest quality data. Lower values indicate the degree that the response may vary from the actual conditions on the road.
<coordinates> 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.
<openlr> OpenLR code for segment

Http Response Codes

If there is an error in the supplied parameters or any other internal problem an error response is generated in the requested format. If the contentType parameter could not be parsed, XML will be returned.

Code Meaning and Possible Causes
200 OK
400 Bad request, usually due to malformed syntax or incorrect parameters
403 Forbidden: Supplied API key is not valid for this request
500 Internal Server Error