Junction Analytics Tools

Junction Analytics Tools

Monitor traffic flow at intersections with real-time and historical data. These tools let you search your junction inventory, check live congestion metrics, and download historical archives for trend analysis.

Recommended workflow: Use tomtom-junction-search first to discover junction IDs, then pass them to tomtom-junction-live-data or tomtom-junction-archive for traffic analysis.


Search and filter all junctions by name, status, country, or other properties.

Parameters

ParameterTypeRequiredDescription
viewenumNocompact (default) or full. Compact returns the junctions table only. Full adds approaches and exits tables
sql_queriesobjectYesNamed SQL queries

SQL Tables

junctions: Always available

ColumnTypeDescription
junction_idstringUnique junction identifier
namestringJunction name
statusstringACTIVE, PENDING_UPDATE, or ERROR
country_codestringISO 3166-1 alpha-3 code (e.g., ESP, DEU, USA, GBR)
drive_on_leftnumber0 or 1
traffic_lightsnumber0 or 1
num_approachesnumberNumber of approaches
num_exitsnumberNumber of exits
created_atstringCreation timestamp
last_modified_atstringLast modification timestamp
time_zonestringTimezone identifier

approaches: Full view only

ColumnTypeDescription
junction_idstringReference to junction
approach_idnumberApproach identifier
namestringApproach name
road_namestringRoad name
directionstringNORTH, SOUTH, EAST, WEST
frcnumberFunctional road class (0–7)
lengthnumberLength in meters
one_way_roadnumber0 or 1
excludednumber0 or 1
drivablenumber0 or 1

exits: Full view only

ColumnTypeDescription
junction_idstringReference to junction
exit_idnumberExit identifier
namestringExit name
road_namestringRoad name
directionstringNORTH, SOUTH, EAST, WEST
frcnumberFunctional road class (0–7)
one_way_roadnumber0 or 1
drivablenumber0 or 1

Example SQL Queries

1-- Find junctions by name
2SELECT junction_id, name, country_code FROM junctions WHERE name ILIKE '%highway%'
3
4-- Count junctions by country
5SELECT country_code, COUNT(*) as count FROM junctions GROUP BY country_code ORDER BY count DESC
6
7-- Find junctions by road name (full view)
8SELECT j.junction_id, j.name, a.road_name
9FROM junctions j
10JOIN approaches a ON j.junction_id = a.junction_id
11WHERE a.road_name ILIKE '%Main%'

tomtom-junction-live-data

Access real-time traffic metrics for junctions, including delays, queue lengths, stops, turn ratios, and volume. Supports up to 20 junctions per request for cross-junction comparisons.

Parameters

ParameterTypeRequiredDescription
junctionIdsstring[]YesJunction IDs to query (1–20). Data is merged for cross-junction SQL
includeGeometrybooleanNoSet true to populate metadata tables with junction geometry
sql_queriesobjectYesNamed SQL queries

SQL Tables

approaches: Real-time metrics per approach

ColumnTypeDescription
junction_idstringJunction ID
approach_idnumberApproach identifier
travel_time_secnumberTravel time in seconds
free_flow_travel_time_secnumberFree flow travel time
delay_secnumberDelay in seconds
usual_delay_secnumberUsual delay in seconds
stopsnumberNumber of stops
queue_length_metersnumberQueue length
volume_per_hournumberTraffic volume per hour
is_closednumber0 or 1

turn_ratios: Turn distribution at junction

ColumnTypeDescription
junction_idstringJunction ID
approach_idnumberApproach identifier
exit_idnumberExit identifier
exit_indexnumberExit index
ratio_percentnumberTurn ratio as percentage
probes_countnumberNumber of probe samples

stops_histogram: Distribution of stop counts

ColumnTypeDescription
junction_idstringJunction ID
approach_idnumberApproach identifier
number_of_stopsnumberStop count bucket
number_of_vehiclesnumberVehicle count in bucket

junction_metadata, approach_metadata, exit_metadata: Available when includeGeometry is true. Contains the same columns as the junction search tables plus geometry data.

Example SQL Queries

1-- Most delayed approaches
2SELECT junction_id, approach_id, delay_sec, queue_length_meters
3FROM approaches
4ORDER BY delay_sec DESC
5LIMIT 5
6
7-- Turn ratios for a specific approach
8SELECT exit_id, ratio_percent
9FROM turn_ratios
10WHERE approach_id = 1
11ORDER BY ratio_percent DESC
12
13-- Compare junctions by average delay
14SELECT junction_id, ROUND(AVG(delay_sec), 2) as avg_delay
15FROM approaches
16GROUP BY junction_id
17ORDER BY avg_delay DESC

tomtom-junction-archive

Download minute-by-minute historical traffic data for junctions over a date range (maximum 2 days). Supports up to 20 junctions per request.

Parameters

ParameterTypeRequiredDescription
junctionIdsstring[]YesJunction IDs to query (1–20). Data is merged for cross-junction SQL
fromstringYesStart date (YYYY-MM-DD)
tostringNoEnd date (YYYY-MM-DD). Maximum 2-day range from start
sql_queriesobjectYesNamed SQL queries

SQL Tables

approaches: Historical approach metrics with timestamps

ColumnTypeDescription
timestringISO timestamp
junction_idstringJunction ID
approach_idstringApproach identifier
travel_time_secnumberTravel time in seconds
free_flow_travel_time_secnumberFree flow travel time
delay_secnumberDelay in seconds
usual_delay_secnumberUsual delay in seconds
stopsnumberNumber of stops
queue_length_metersnumberQueue length
volume_per_hournumberTraffic volume per hour
is_closednumber0 or 1

turn_ratios: Historical turn ratios with timestamps

ColumnTypeDescription
timestringISO timestamp
junction_idstringJunction ID
approach_idstringApproach identifier
exit_idstringExit identifier
exit_indexnumberExit index
ratio_percentnumberTurn ratio as percentage
probes_countnumberProbe sample count

Example SQL Queries

1-- Hourly average delays
2SELECT date_part('hour', time::TIMESTAMP) as hour,
3 ROUND(AVG(delay_sec), 2) as avg_delay,
4 MAX(delay_sec) as max_delay
5FROM approaches
6GROUP BY hour
7ORDER BY hour
8
9-- Peak congestion periods
10SELECT time::DATE as day,
11 date_part('hour', time::TIMESTAMP) as hour,
12 ROUND(AVG(delay_sec), 2) as avg_delay
13FROM approaches
14WHERE delay_sec > 30
15GROUP BY day, hour
16ORDER BY avg_delay DESC
17LIMIT 10