Promise resolving to a TrafficAreaAnalytics FeatureCollection
It needs a TomTom Move Portal API key, passed as apiKey on the call. It is
not available on a Freemium or Pay As You Grow (PAYG) basis, so request access from TomTom Sales.
A lite report has these constraints:
geometry) may be submitted per request.endDate falls one to 31 days after startDate.The key data returned per region is:
baseData: overall aggregated metrics for the full analysis periodtimedData: time-series breakdown at yearly / monthly / weekly / daily / hourly granularity, and an average
week, all in UTCtiledData: per-tile heatmap metrics (when available)anomalies: detected traffic anomalies keyed by camelCase metric key (e.g. anomalies.speed). They stay
empty, as the service detects them only over 35 days or more.The available metrics are:
speed: average speed on the road network (km/h)freeFlowSpeed: average speed under uncongested conditions (km/h)congestionLevel: percentage increase in travel time above free-flowtravelTime: average travel time per 10 km (minutes)networkLength: total length of road segments with data (meters)// Basic speed and congestion analysis for Amsterdam
const result = await trafficAreaAnalytics({
days: ['2024-08-06'],
functionalRoadClasses: ['MOTORWAY', 'MAJOR_ROAD', 'OTHER_MAJOR_ROAD', 'SECONDARY_ROAD', 'LOCAL_CONNECTING_ROAD', 'LOCAL_ROAD_HIGH_IMPORTANCE'],
hours: [7, 8, 9, 17, 18],
metrics: ['speed', 'congestionLevel'],
geometry: {
type: 'Polygon',
coordinates: [
[[4.896128, 52.382402], [4.875701, 52.368459], [4.923611, 52.36341], [4.896128, 52.382402]]
]
}
});
const region = result.features[0];
console.log(region.properties.baseData.speed); // avg speed (km/h)
console.log(region.properties.baseData.congestionLevel); // congestion %
console.log(region.properties.timedData.hourly); // hourly breakdown
// Full metrics over a multi-day period
const result = await trafficAreaAnalytics({
startDate: new Date('2024-08-01'),
endDate: new Date('2024-08-07'),
functionalRoadClasses: 'all',
hours: 'all',
metrics: ['speed', 'freeFlowSpeed', 'congestionLevel', 'travelTime', 'networkLength'],
geometry: {
type: 'Polygon',
coordinates: [[[4.89, 52.37], [4.91, 52.37], [4.91, 52.39], [4.89, 52.39], [4.89, 52.37]]]
}
});
result.features[0].properties.timedData.daily?.forEach(day => {
console.log(day.date, day.congestionLevel);
});
Runs a synchronous traffic area analytics report for a polygon region.
It submits a single Polygon or MultiPolygon region with a date range and requested metrics, and receives the full analysis result immediately, with no polling.