Live Traffic Tools

Live Traffic Tools

Query real-time traffic conditions for specific locations and areas. Get flow data for individual road segments, or retrieve active incidents across named bounding boxes with multi-area comparison.


tomtom-traffic-flow-segment

Get real-time traffic flow information for the road segment closest to given coordinates.

Parameters

ParameterTypeRequiredDescription
pointobjectYesCoordinates: latitude (-90 to +90) and longitude (-180 to +180)
styleenumYesabsolute, relative, relative0, relative0-dark, relative-delay, reduced-sensitivity
zoomnumberYesZoom level (0–22). Affects road segment visibility and precision
formatenumNoxml, json (default), or jsonp
unitenumNokmph (default) or mph
thicknessnumberNoSegment width multiplier (1–20, default 10)
openLrbooleanNoInclude OpenLR code in response (default false)
sql_queriesobjectYesNamed SQL queries

SQL Tables

flow_segment: Single row with traffic flow data

ColumnTypeDescription
frcstringFunctional road class (FRC0FRC6)
current_speednumberCurrent speed
free_flow_speednumberFree flow speed
current_travel_timenumberCurrent travel time in seconds
free_flow_travel_timenumberFree flow travel time in seconds
confidencenumberConfidence level (0–1)
road_closurenumber0 or 1
coordinatesstringJSON-stringified coordinate array
openlrstringOpenLR code (if requested)
geom_geojsonstringFull GeoJSON geometry as LineString

Example SQL Queries

1-- Get segment overview
2SELECT frc, current_speed, free_flow_speed, confidence, road_closure
3FROM flow_segment
4
5-- Calculate delay
6SELECT current_travel_time - free_flow_travel_time as delay_seconds,
7 ROUND((current_travel_time - free_flow_travel_time) * 100.0
8 / NULLIF(free_flow_travel_time, 0), 1) as delay_percent
9FROM flow_segment

tomtom-traffic-incidents

Query live traffic incidents (accidents, jams, closures, roadworks) for named bounding boxes. Supports up to 10 bounding boxes for multi-area comparison.

Parameters

ParameterTypeRequiredDescription
bboxesobject[]YesNamed bounding boxes (1–10). Each has name (string) and bbox (string: "minLon,minLat,maxLon,maxLat")
languagestringNoLanguage code: en-US (default), de-DE, fr-FR, es-ES
maxResultsnumberNoMax incidents per area (1–1000, recommended 10–20)
categoryFilterstringNoComma-separated codes: 0=Accident, 1=Fog, 2=Dangerous, 3=Rain, 4=Ice, 5=JamLane, 6=LaneClosure, 7=RoadClosure, 8=RoadWorks, 9=Wind, 10=Flooding, 11=Detour, 14=Cluster
timeValidityFilterenumNopresent (default) or future
sql_queriesobjectYesNamed SQL queries

SQL Tables

incidents: One row per incident

ColumnTypeDescription
area_namestringArea name from bounding box (for multi-area queries)
idstringIncident ID
iconCategorystringAccident, Fog, Dangerous, Rain, Ice, JamLane, LaneClosure, RoadClosure, RoadWorks, Wind, Flooding, Detour, Cluster
magnitudeOfDelaystringDelay magnitude
startTimestringIncident start time
endTimestringIncident end time
fromstringLocation "from" description
tostringLocation "to" description
lengthnumberAffected area length in meters
delaynumberDelay in seconds. NULL for RoadWorks (informational only)
roadNumbersstringJSON-stringified array of road numbers
timeValiditystringTime validity
probabilityOfOccurrencestringProbability description
numberOfReportsnumberReport count
lastReportTimestringLast report timestamp

Note: The delay column contains real-time measurements for Accident, JamLane, and LaneClosure incidents. RoadWorks are informational and have NULL delay values. Use WHERE delay IS NOT NULL to exclude them from delay calculations.

Example SQL Queries

1-- Count incidents by type
2SELECT iconCategory, COUNT(*) as count
3FROM incidents
4GROUP BY iconCategory
5ORDER BY count DESC
6
7-- Top delays (exclude informational RoadWorks)
8SELECT id, iconCategory, delay, "from", "to"
9FROM incidents
10WHERE delay IS NOT NULL
11ORDER BY delay DESC
12LIMIT 10
13
14-- Multi-area comparison
15SELECT area_name,
16 COUNT(*) as total_incidents,
17 SUM(CASE WHEN iconCategory = 'Accident' THEN 1 ELSE 0 END) as accidents,
18 SUM(CASE WHEN iconCategory = 'RoadWorks' THEN 1 ELSE 0 END) as roadworks
19FROM incidents
20GROUP BY area_name