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.
- Documentation: Traffic API
- Uses
TOMTOM_API_KEY
tomtom-traffic-flow-segment
Get real-time traffic flow information for the road segment closest to given coordinates.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
point | object | Yes | Coordinates: latitude (-90 to +90) and longitude (-180 to +180) |
style | enum | Yes | absolute, relative, relative0, relative0-dark, relative-delay, reduced-sensitivity |
zoom | number | Yes | Zoom level (0–22). Affects road segment visibility and precision |
format | enum | No | xml, json (default), or jsonp |
unit | enum | No | kmph (default) or mph |
thickness | number | No | Segment width multiplier (1–20, default 10) |
openLr | boolean | No | Include OpenLR code in response (default false) |
sql_queries | object | Yes | Named SQL queries |
SQL Tables
flow_segment: Single row with traffic flow data
| Column | Type | Description |
|---|---|---|
frc | string | Functional road class (FRC0–FRC6) |
current_speed | number | Current speed |
free_flow_speed | number | Free flow speed |
current_travel_time | number | Current travel time in seconds |
free_flow_travel_time | number | Free flow travel time in seconds |
confidence | number | Confidence level (0–1) |
road_closure | number | 0 or 1 |
coordinates | string | JSON-stringified coordinate array |
openlr | string | OpenLR code (if requested) |
geom_geojson | string | Full GeoJSON geometry as LineString |
Example SQL Queries
1-- Get segment overview2SELECT frc, current_speed, free_flow_speed, confidence, road_closure3FROM flow_segment45-- Calculate delay6SELECT current_travel_time - free_flow_travel_time as delay_seconds,7 ROUND((current_travel_time - free_flow_travel_time) * 100.08 / NULLIF(free_flow_travel_time, 0), 1) as delay_percent9FROM 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
| Parameter | Type | Required | Description |
|---|---|---|---|
bboxes | object[] | Yes | Named bounding boxes (1–10). Each has name (string) and bbox (string: "minLon,minLat,maxLon,maxLat") |
language | string | No | Language code: en-US (default), de-DE, fr-FR, es-ES |
maxResults | number | No | Max incidents per area (1–1000, recommended 10–20) |
categoryFilter | string | No | Comma-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 |
timeValidityFilter | enum | No | present (default) or future |
sql_queries | object | Yes | Named SQL queries |
SQL Tables
incidents: One row per incident
| Column | Type | Description |
|---|---|---|
area_name | string | Area name from bounding box (for multi-area queries) |
id | string | Incident ID |
iconCategory | string | Accident, Fog, Dangerous, Rain, Ice, JamLane, LaneClosure, RoadClosure, RoadWorks, Wind, Flooding, Detour, Cluster |
magnitudeOfDelay | string | Delay magnitude |
startTime | string | Incident start time |
endTime | string | Incident end time |
from | string | Location "from" description |
to | string | Location "to" description |
length | number | Affected area length in meters |
delay | number | Delay in seconds. NULL for RoadWorks (informational only) |
roadNumbers | string | JSON-stringified array of road numbers |
timeValidity | string | Time validity |
probabilityOfOccurrence | string | Probability description |
numberOfReports | number | Report count |
lastReportTime | string | Last report timestamp |
Note: The
delaycolumn contains real-time measurements for Accident, JamLane, and LaneClosure incidents. RoadWorks are informational and have NULL delay values. UseWHERE delay IS NOT NULLto exclude them from delay calculations.
Example SQL Queries
1-- Count incidents by type2SELECT iconCategory, COUNT(*) as count3FROM incidents4GROUP BY iconCategory5ORDER BY count DESC67-- Top delays (exclude informational RoadWorks)8SELECT id, iconCategory, delay, "from", "to"9FROM incidents10WHERE delay IS NOT NULL11ORDER BY delay DESC12LIMIT 101314-- Multi-area comparison15SELECT 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 roadworks19FROM incidents20GROUP BY area_name