Traffic Incident Details parameters (bbox, polygon or ids)
Promise resolving to a TrafficIncidentDetails object containing the matching incidents
The query modes are:
bbox) returns all incidents within the given area, of at most 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, and POST for up to 100.Each incident provides:
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
});
Fetches detailed information about traffic incidents.
It queries 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).