Traffic Incident Details parameters (bbox, polygon or ids)
Promise resolving to a TrafficIncidentDetails object containing the matching incidents
Three query modes:
bbox): Returns all incidents within the given area.
Maximum area is 10,000 km².polygon): Returns the incidents that intersect a polygon, such as a city boundary.
The request covers the polygon's bounding box, and the response is trimmed to the polygon.ids): Returns the specified incidents directly.
GET is used automatically for up to 5 IDs; POST for up to 100 IDs.Key data provided per incident:
category): type of incident (accident, roadworks, jam, etc.)minor, moderate, major, …)present or future// Query by bounding box (Amsterdam area)
const result = await trafficIncidentDetails({
bbox: [4.728, 52.278, 5.080, 52.479]
});
result.features.forEach(incident => {
console.log(incident.properties.category); // 'accident' | 'jam' | …
console.log(incident.properties.magnitudeOfDelay); // 'minor' | 'major' | …
console.log(incident.geometry); // Point or LineString
});
// Query within a city boundary rather than its bounding box
const place = await geocodeOne('Amsterdam');
const result = await trafficIncidentDetails({
polygon: await geometryData({ geometries: [place] })
});
// Query up to 5 specific incidents by ID (GET)
const result = await trafficIncidentDetails({
ids: ['incident-id-1', 'incident-id-2']
});
// Query many incident IDs — POST is used automatically when ids.length > 5
const result = await trafficIncidentDetails({
ids: largeIdArray
});
Fetch detailed information about traffic incidents.
Query incidents by a geographic bounding box, by a polygon, or by a list of incident IDs. Results are GeoJSON Features whose geometry is a
Point(localised incidents) or aLineString(incidents spanning a stretch of road).