次の方法で共有


Getting Traffic Incident Data

Note

Bing Maps Get Traffic Incidents API retirement

Bing Maps Get Traffic Incidents API is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Get Traffic Incidents API until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Get Traffic Incidents API until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Get Traffic Incidents API will need to be updated to use Azure Maps Get Traffic Incident Detail API by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate Bing Maps Get Traffic Incidents API.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

You can get traffic incident information along a route using the Routes and for a geographical area by using the Traffic. Traffic incident information is provided in two ways:

  • Traffic incident details including description, severity, location, type of incident.

  • Traffic location codes that specify incident information for a road segment or specific location as a code, such as 120-15918. A subscription is typically required to interpret and use the traffic location codes.

For traffic coverage by country/region, see Bing Maps Geographic Coverage.

Traffic incident information along a route (Routes API)

Each route segment (itinerary item) returned by the Routes API may include a set of traffic location codes and a set of warnings that specify traffic incident information along that part of the route. The warnings include a description of the incident, the severity, and a warning type, such as Accident or BlockedRoad. To see a list of the warning types, see Warning Types.

There is no specific correlation between traffic location codes and warnings. For example, an itinerary item can contain traffic location codes without corresponding warnings.

The following is an example of an itinerary item that contains both warnings and traffic location codes.

{  
   "itineraryItems":[  
      {  
         "compassDirection":"south",  
         "details":[  
            {  
               "compassDegrees":180,  
               "endPathIndices":[  
                  1  
               ],  
               "locationCodes":[  
                  "114-08912",  
                  "114-08911"  
               ],  
               "maneuverType":"DepartStart",  
               "mode":"Driving",  
               "names":[  
                  "44TH Ave W"  
               ],  
               "roadType":"Arterial",  
               "startPathIndices":[  
                  0  
               ]  
            }  
         ],  
         "exit":"",  
         "iconType":"Auto",  
         "instruction":{  
            "maneuverType":"DepartStart",  
            "text":"Depart 44TH Ave W toward 192ND St SW"  
         },  
         "maneuverPoint":{  
            "type":"Point",  
            "coordinates":[  
               47.825321,  
               -122.292407  
            ]  
         },  
         "sideOfStreet":"Unknown",  
         "tollZone":"",  
         "towardsRoadName":"192ND St SW",  
         "transitTerminus":"",  
         "travelDistance":1.029,  
         "travelDuration":97,  
         "travelMode":"Driving"  
      },  
      {  
         "compassDirection":"southwest",  
         "details":[  
            {  
               "compassDegrees":217,  
               "endPathIndices":[  
                  6  
               ],  
               "maneuverType":"TakeRampRight",  
               "mode":"Driving",  
               "roadType":"Ramp",  
               "startPathIndices":[  
                  1  
               ]  
            },  
            {  
               "compassDegrees":241,  
               "endPathIndices":[  
                  91  
               ],  
               "locationCodes":[ "114-04212", "114N04212", "114-04211", "114N04211", "114N04207", "114-04195" ],  
               "maneuverType":"Merge",  
               "mode":"Driving",  
               "names":[  
                  "I-5 South"  
               ],  
               "roadShieldRequestParameters":{  
                  "bucket":50402,  
                  "shields":[  
                     {  
                        "labels":[  
                           "5"  
                        ],  
                        "roadShieldType":1  
                     }  
                  ]  
               },  
               "roadType":"LimitedAccessHighway",  
               "startPathIndices":[  
                  6  
               ]  
            }  
         ],  
         "exit":"",  
         "iconType":"Auto",  
         "instruction":{  
            "maneuverType":"RampThenHighwayRight",  
            "text":"Take ramp right for I-5 South"  
         },  
         "maneuverPoint":{  
            "type":"Point",  
            "coordinates":[  
               47.816019,  
               -122.292332  
            ]  
         },  
         "sideOfStreet":"Unknown",  
         "tollZone":"",  
         "transitTerminus":"",  
         "travelDistance":24.323,  
         "travelDuration":908,  
         "travelMode":"Driving",  
         "warnings":[ { "severity":"Minor", "text":"Minor Congestion: slow 1st Av\/Northgate Way (#173) to Express Lanes Southern Entrance\/Exit", "warningType":"Congestion" } ]  
      }  
   ]  
}  

Traffic incident information within a geographical area (Traffic API)

The Traffic API returns a list of traffic incidents in a geographical area and provides incident details and traffic location codes. Traffic incident details include information such as the incident description, severity, location, road closures, type of incident, and time of incident. See Traffic Incident Data for a list of the incident details that may be returned. Traffic incidents reported by the Traffic API include common traffic problems, such as accidents and disabled vehicles, as well as other potential causes of traffic, such as sports events.

To use the Traffic API, you must specify an area defined as a bounding box. A bounding box is a set of longitudes and latitudes that define an area. See Location and Area Types for more information about a bounding box.

The following is an example of traffic incident information returned in a JSON Traffic API response.

{  
   "__type":"TrafficIncident:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",  
   "point":{  
      "type":"Point",  
      "coordinates":[  
         38.64829,  
         -94.36405  
      ]  
   },  
   "congestion":"",  
   "description":"in both directions between MO-2\/MO-7 and MO-291\/Cantrell Rd - construction",  
   "end":"\/Date(1316217600000)\/",  
   "incidentId":214828828,  
   "lane":"Total Lanes lane blocked",  
   "lastModified":"\/Date(1310385750290)\/",  
   "roadClosed":false,  
   "severity":2,  
   "start":"\/Date(1310126400000)\/",  
   "toPoint":{  
      "type":"Point",  
      "coordinates":[  
         38.65831,  
         -94.36706  
      ]  
   },  
   "locationCodes":[  
      "119+05041",  
      "119+05042",  
      "119-05041",  
      "119-05042",  
      "119N05041",  
      "119N05042",  
      "119P05041",  
      "119P05042"  
   ],  
   "type":9,  
   "verified":true  
}