Junction live data details

Service version: v1
Last edit: 2022.08.19

Purpose

Junction definition details is a REST API endpoint that reads dynamic real-time information about a selected junction. It contains the live metrics for each junction approach including travel time, delay, stops, queue length, and turn ratios for each exit. The response can also, on demand, contain information about the junction model: a junction boundary, its approaches, and exits.

Request data

You can obtain Junction live data details by sending a GET request.

  • 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 method: GET

https://api.tomtom.com/junction-analytics/junctions/1/{junctionId}/live-data?key={Your_API_Key}&includeGeometry={includeGeometry}

Request parameters

The following table shows the request parameters.

  • Required parameters must be used or the call will fail.
  • Optional parameters may be used.

Required parameters

Description

junctionId
string
The unique junction id that must be used in the request path.
key
string

An API Key valid for the requested service.


Value: Your valid API Key.

Optional parameters

Description

includeGeometry
boolean

If true, the junction geometry is included in the response.


Value: true or false

Request headers

Header

Value

Content-Type

application/json

Example request

The following is an example curl request:

$ curl '/junction-analytics/junctions/1/{junctionId}/live-data?key={Your_API_Key}&includeGeometry={includeGeometry}' -i -X GET \
-H 'Content-Type: application/json' \

Response data

This response returns junction live data details.

Example response

The following is an example response in JSON format:

1{
2 "id": "5fd9bb5a88a13608d7b5d92d",
3 "approachesLiveData": [
4 {
5 "id": -1497841953,
6 "travelTimeSec": 25,
7 "freeFlowTravelTimeSec": 25,
8 "delaySec": 0,
9 "usualDelaySec": 0,
10 "stops": 0,
11 "queueLengthMeters": 0,
12 "isClosed": true,
13 "turnRatios": [
14 {
15 "exitId": 2032081462,
16 "exitIndex": 2,
17 "ratioPercent": 100,
18 "probesCount": 535
19 }
20 ]
21 },
22 {
23 "id": -531148112,
24 "travelTimeSec": 57,
25 "freeFlowTravelTimeSec": 57,
26 "delaySec": 0,
27 "usualDelaySec": 0,
28 "stops": 0,
29 "queueLengthMeters": 0,
30 "isClosed": false,
31 "turnRatios": [
32 {
33 "exitId": -351401112,
34 "exitIndex": 2,
35 "ratioPercent": 100,
36 "probesCount": 421
37 }
38 ]
39 }
40 ],
41 "junctionModel": {
42 "name": "First Street - Second Street",
43 "countryCode": "DEU",
44 "driveOnLeft": false,
45 "trafficLights": true,
46 "approaches": [
47 {
48 "id": 1397964518,
49 "name": "First Street West Bound",
50 "roadName": "First Street",
51 "direction": "WEST",
52 "frc": 7,
53 "length": 192.77,
54 "oneWayRoad": false,
55 "excluded": false,
56 "drivable": true,
57 "segmentedGeometry": {
58 "type": "MultiLineString",
59 "coordinates": [
60 [
61 [19.45464, 51.77712],
62 [19.45452, 51.77711],
63 [19.45443, 51.77708]
64 ]
65 ]
66 },
67 "userPoints": [
68 {
69 "type": "Point",
70 "coordinates": [19.45464, 51.77712]
71 },
72 {
73 "type": "Point",
74 "coordinates": [19.45443, 51.77708]
75 }
76 ],
77 "openlr": "Cw3VGCTJOhJTB/5H/toWSXY=",
78 "dataNotAvailable": false
79 },
80 {
81 "id": -2036692957,
82 "name": "Second Street North Bound",
83 "roadName": "Second Street",
84 "direction": "NORTH",
85 "frc": 4,
86 "length": 236.16,
87 "oneWayRoad": true,
88 "excluded": false,
89 "drivable": true,
90 "segmentedGeometry": {
91 "type": "MultiLineString",
92 "coordinates": [
93 [
94 [19.45265, 51.77446],
95 [19.45224, 51.77653],
96 [19.45224, 51.77657]
97 ]
98 ]
99 },
100 "userPoints": [
101 {
102 "type": "Point",
103 "coordinates": [19.45265, 51.77446]
104 },
105 {
106 "type": "Point",
107 "coordinates": [19.45224, 51.77657]
108 }
109 ],
110 "openlr": "Cw3VGCTJOhJTB/5H/toWSXY=",
111 "dataNotAvailable": false
112 }
113 ],
114 "exits": [
115 {
116 "id": 2032081462,
117 "name": "First Street North Bound",
118 "roadName": "First Street",
119 "direction": "NORTH",
120 "frc": 4,
121 "oneWayRoad": false,
122 "drivable": true,
123 "segmentedGeometry": {
124 "type": "MultiLineString",
125 "coordinates": [
126 [
127 [19.45224, 51.77657],
128 [19.45222, 51.77665]
129 ]
130 ]
131 },
132 "openlr": "Dw3VGCTJOhJTB/5H/toWSXY="
133 },
134 {
135 "id": -351401112,
136 "name": "Second Street East Bound",
137 "roadName": "Second Street",
138 "direction": "EAST",
139 "frc": 7,
140 "oneWayRoad": false,
141 "drivable": true,
142 "segmentedGeometry": {
143 "type": "MultiLineString",
144 "coordinates": [
145 [
146 [19.45224, 51.77657],
147 [19.4525, 51.77659]
148 ]
149 ]
150 },
151 "openlr": "Ew3VGCTJOhJTB/5H/toWSXY="
152 }
153 ]
154 }
155}

Response fields

The following table describes all of the fields that can appear in a response.

Field

Description

id
string
This is the unique ID of the junction.
approachesLiveData[]
array
This is the array of approaches live data.
approachesLiveData[].id
string
The unique approach ID in the junction context.
approachesLiveData[].travelTimeSec
integer

The time it takes to travel the full approach. This is updated every minute.

approachesLiveData[].freeFlowTravelTimeSec
integer

The time it takes to travel the full approach without any delays (usually at nights); the fixed value from historical data.

approachesLiveData[].delaySec
integer

Travel time - free-flow travel time. This is updated every minute.

approachesLiveData[].usualDelaySec
integer

This is the usual delay that is expected at this time of day, on this day of the week (as derived using historical data). This is calculated by using data from speed profiles, and fixed value from historical data.

approachesLiveData[].stops
integer

The average number of stops per vehicle. This is updated every minute.

approachesLiveData[].queueLengthMeters
integer

This is the queue length in case of a longer-lasting congestion. It might be longer than the length of the approach. This is updated every minute.

approachesLiveData[].isClosed
boolean
This informs if the approach is currently closed.

approachesLiveData[].volumePerHour*
integer

*Experimental. The approximated number of vehicles that have driven through the approach in the last hour.

approachesLiveData[].turnRatios[]
array
This is a list of turn ratios for the approach.
approachesLiveData[].turnRatios[].exitId
integer
The exit identifier that this turn ratio points to.
approachesLiveData[].turnRatios[].exitIndex
integer
The exit index that this turn ratio points to.
approachesLiveData[].turnRatios[].ratioPercent
integer

The ratios are calculated for the last thirty (30) minutes. Only exits for which traffic has been observed are included in the output. This is updated every thirty minutes.

approachesLiveData[].turnRatios[].probesCount
integer

This is the absolute number of observed probes for this particular approach to exit pass, as occurred during last thirty minutes.

junctionModel
object

Contains the junction geometry and other data. This is not available when the includeGeometry query param is false. This is not available in ERROR status.

junctionModel.name
string

The name of the junction as generated automatically, or provided in the junction definition creation request.

junctionModel.countryCode
string

The three-letter country code as defined in

ISO 3166-1 alpha-3 standard

.

junctionModel.driveOnLeft
boolean

The flag with information about left-hand traffic (LHT) or right-hand traffic (RHT).

junctionModel.trafficLights
boolean

This is true if there are traffic lights inside the creation area.

junctionModel.approaches[]
array

This contains junction approaches.


The minimum number of approaches: 1

junctionModel.approaches[].id
integer
The approach ID is unique in the junction context.
junctionModel.approaches[].name
string

This is created based on the name and road direction.


Example: "Some Street West Bound".

junctionModel.approaches[].roadName
string
If the road has no name it is "Unnamed road".
junctionModel.approaches[].direction
string

It is one of the following values: SOUTH, WEST , EAST, NORTH, CLOCKWISE, COUNTER_CLOCKWISE.

junctionModel.approaches[].frc
integer

Functional Road Class. It is one of the following values: 0 , 1, 2, 3, 4, 5, 6, 7.

junctionModel.approaches[].length
float
Length of the given approach in meters.
junctionModel.approaches[].oneWayRoad
boolean

It is true, if it is a one-direction road or not a single carriageway road.

junctionModel.approaches[].excluded
boolean
Indicates that live data for the approach is collected.
junctionModel.approaches[].drivable
boolean
Indicates if the road is drivable.
junctionModel.approaches[].segmentedGeometry
object

The geometry of the given approach, split by map segments. See the

GeoJson MultiLineString specification

.

junctionModel.approaches[].userPoints
array

Array of user decided points that the geometry routes through. See the

GeoJson Point specification

.

junctionModel.approaches[].openlr
string

Geometry of the given approach, encoded into OpenLR format. See the OpenLR specification.

junctionModel.exits[]
array

This contains junction exits.


The minimum number of exits: 1

junctionModel.exits[].id
integer
The exit ID is unique in the junction context.
junctionModel.exits[].name
string

This is created based on the name and road direction.


Example: "Typical Street West Bound".

junctionModel.exits[].roadName
string
If the road has no name, it will be called "Unnamed road".
junctionModel.exits[].direction
string

It is one of the following values: SOUTH, WEST , EAST, NORTH, CLOCKWISE, COUNTER_CLOCKWISE.

junctionModel.exits[].frc
integer

Functional Road Class. It is one of the following values: 0 , 1, 2, 3, 4, 5, 6, 7.

junctionModel.exits[].oneWayRoad
boolean

It is true if it is a one-directional road or not a single carriageway road.

junctionModel.exits[].drivable
boolean
Indicates if the road is drivable.
junctionModel.exits[].segmentedGeometry
object

The geometry of a given exit, split by map segments. See the

GeoJson MultiLineString specification

.

junctionModel.exits[].openlr
string

Geometry of the given exit, encoded into OpenLR format. See the OpenLR specification.

Junction Status

The following table shows the junction status.

Value

Description

PREVIEWJunction is processing, live data is not served.
ACTIVEJunction is processed, live data is served.
PENDING_UPDATEJunction is processing after update, live data is not served.
ERRORSomething bad happened (an error occurred).

Errors

An error response is generated if there is an error in the supplied parameters, or any other internal problem. The error response is generated in the requested format.

Error response codes

The following table gives the HTTP error response codes.

Code

Description

400Bad Request

Example: Junction 5fd9b98a88a13608d7b5d92c is not yet active, no live data available!

401Unauthorized
403Forbidden
404Not Found
  • Junction with specified id does not exist or is in ARCHIVED state.

  • Junction of id 5fd8da2b84510126b9d18b0d is not found.

Error response field

Field

Description

errorMessage
string
Problem description.

Example error response

1{
2 "errorMessage": "Junction 5fd9b98a88a13608d7b5d92c is not yet active, no live data available!"
3}