This article explains how to migrate the Bing Maps Get Traffic Incidents API to the Azure Maps Get Traffic Incident Detail API. The Azure Maps Get Traffic Incident Detail API provides data on construction, road closures, accidents, and other incidents that can affect traffic, and is updated every minute.
Azure Maps Get Traffic Incident Detail API is designed to display traffic incidents on map tiles.
Azure Maps requires boundingZoom to be specified in addition to boundingbox. boundingZoom is the zoom level (0 - 22) for raster and vector tiles.
Azure Maps requires style to be specified. The style that is used to render the tile in Azure Maps [Traffic Incident Tile] API. This affects the coordinates of traffic incidents in the reply.
Azure Maps requires a number referencing traffic model (trafficModelId), obtained from the Azure Maps Get Traffic Incident Viewport API. It updates every minute and is valid for two minutes before it times out. If the wrong Traffic Model ID is specified, the interface returns the correct value. As an alternative to using the Azure Maps Get Traffic Incident Viewport API, passing a value of -1 for Traffic Model ID in the Azure Maps Traffic Incident Tile request always invokes the most recent traffic model.
Bing Maps Get Traffic Incidents API supports specifying traffic incident severity and types in the request. The Azure Maps Get Traffic Incident Detail API instead returns all traffic incident severity and types by default in the response.
Azure Maps Get Traffic Incident Detail API generally provides more details regarding traffic delays than the Bing Maps Get Traffic Incidents API. Specifically, in Azure Maps, the dl output provides delay time in seconds that the traffic incident caused, and the DelayMagnitude output provides the magnitude of delay associated with incident (these values correspond to incident colors in the traffic tiles).
Unlike Bing Maps for Enterprise, Azure Maps is a global service that supports specifying a geographic scope, which allows you to limit data residency to the European (EU) or United States (US) geographic areas (geos). All requests (including input data) are processed exclusively in the specified geographic area. For more information, see Azure Maps service geographic scope.
The following table lists the Bing Maps Get Traffic Incidents request parameters and the Azure Maps equivalent:
Bing Maps request parameter
Bing Maps request parameter alias
Azure Maps request parameter
Required in Azure Maps
Azure Maps data type
Description
mapArea
boundingbox
True
number[]
The projection used to specify the boundingbox coordinates in the request and response is EPSG900913 (default) or EPSG4326. Use projection=EPSG4326 for compatibility with the coordinates projection used in the Bing Maps Get Traffic Incidents API.
The following table lists the fields that can appear in the HTTP response when running the Bing Maps Get Traffic Incidents API and the Azure Maps equivalent:
Bing Maps response field
Azure Maps response field
Description
Description (Json) Description (XML)
d
This output is in the tm response element of Azure Maps.
End (Json) EndTimeUTC (XML)
ed
This output is in the tm response element of Azure Maps. The date is described in the ISO8601 format and includes time in UTC.
eventList (Json) EventList (XML)
Not supported
icon (Json) Icon (XML)
ic
This output is in the tm response element of Azure Maps. See IconCategory (ic) for more info.
incidentId (Json) IncidentId (XML)
id
This output is in the tm response element of Azure Maps.
This output is in the tm response element of Azure Maps. See point (p) for more info.
roadClosed (Json) RoadClosed (XML)
See description
The IconCategory output of the tm response element of Azure Maps can be used to indicate a road closure.
severity (Json) Severity (XML)
ty
This output is in the tm response element. See DelayMagnitude: (ty) for more info.
severityScore (Json) SeverityScore (XML)
Not supported
Start (Json) StartTimeUTC (XML)
sd
This output is in the tm response element of Azure Maps. The date is described in the ISO8601 format and includes time in UTC.
title (Json) Title (XML)
See description
The f output in the tm response element of Azure Maps provides the name of the intersection or location where the traffic caused by the the incident starts and can serve as an alternative to the Bing Maps title output.
toPoint (Json) ToPoint (XML)
See description
The t output in the tm response element of Azure Maps provides the name of the intersection or location where the traffic due to the incident ends and can serve as an alternative to the Bing Maps toPoint output.
type (Json) Type (XML)
c
The c output in the tm response element of Azure Maps provides the cause of the incident, if available.
For more information about the Azure Maps Get Traffic Incident Detail API response fields, see Responses.
Response examples
The following JSON sample shows what is returned in the body of the HTTP response when executing the Bing Maps Get Traffic Incidents request:
Like Bing Maps Get Traffic Incidents API, Azure Maps Get Traffic Incident Detail API logs one billable transaction per request. For more information on Azure Maps transactions, see Understanding Azure Maps Transactions.
Additional information
Other Azure Maps Traffic APIs
Get Traffic Flow Segment. Use to get information about the speeds and travel times of the specified section of road.
Learn about writing code to interact with Azure Maps. Develop and test a fun app using JavaScript and Visual Studio Code to find the best route for a truck, car, or bicycle. The route is from the west coast of the USA, to the east coast. You can see how routes change based on vehicle. And, for trucks, how routes vary if the contents are hazardous. You get the chance to add in your own locations.
This article contains a C# example showing all of the data contracts in namespace BingMapsRESTService.Common.JSON, and a link to an article with examples of how to use these data contracts. Note that these data contracts are no longer being updated and may be out of date, refer to the .NET REST Toolkit for the latest JSON contracts.