
The Traffic Web Services from Yahoo! enable you to get traffic alert information from a given location. Use the Traffic REST API to customize your request with many parameters including indicating locations based on a city/state/zip or latitude-longitude, whether to include a map image, or a search radius in miles.
Traffic Web Services are also available through a dynamic RSS feed.
http://local.yahooapis.com/MapsService/V1/trafficData
See information on constructing REST queries
| Parameter | Value | Description |
|---|---|---|
| appid | string (required) | The application ID. See Application IDs for more information. |
| street | string | Street name. The number is optional. |
| city | string | City name. |
| state | string | The United States state. You can spell out the full state name or you can use the two-letter abbreviation. |
| zip | integer or <integer>-<integer> | The five-digit zip code, or the five-digit code plus four-digit extension. If this location contradicts the city and state specified, the zip code will be used for determining the location and the city and state will be ignored. |
| location | free text |
This free field lets users enter any of the following:
If location is specified, it will take priority over the individual fields in determining the location for the query. City, state and zip will be ignored. |
| latitude | float: -90 to 90 | The latitude of the starting location. |
| longitude | float: -180 to 180 | The longitude of the starting location. If both latitude and longitude are specified, they will take priority over all other location data. If only one of latitude or longitude is specified, both will be ignored. |
| severity | integer: 1 to 5 (default: 1) | The minimum severity level to return, from 1 (least severe) to 5 (most severe) |
| zoom | integer: 1 to 12 (default: 6) | The zoom level for the data, from 1 (street level) to 12 (country level). If a radius is specified, this is ignored. |
| radius | float | How far (in miles) from the specified location to provide data for. The default radius varies according to the location given and the zoom level. If a zoom is specified, this is ignored. |
| include_map | 0 (default) or 1 | If set to 1 will return the URL of a map image for the location of each reported incident. |
| image_type | png (default) or gif | The image format for the map (if requested). |
| image_height | integer: 10 to 2000 (default: 500) | The height of the image (if requested) being generated, in pixels. |
| image_width | integer: 10 to 2000 (default: 620 | The width of the image (if requested) being generated, in pixels. |
| output | string: xml (default), php | The format for the output. If php is requested, the results will be returned in Serialized PHP format. |
Sample Request Url: http://local.yahooapis.com/MapsService/V1/trafficData?appid=YD-XYEUXak_JXzY7lo8FC1fSg--&street=701+First+Street&city=Sunnyvale&state=CA
The schema document for this service response is located at http://local.yahooapis.com/MapsService/V1/TrafficDataResponse.xsd
| Field | Description |
|---|---|
| ResultSet | Contains all of the query responses. |
| LastUpdateDate | The last time data for this location was updated, in unix timestamp format. |
| Warning | If there is an issue with the associated map images (such as the exact location not being found), this will contain a brief warning about the problem. |
| Result |
Contains each individual response. Has an attribute:
|
| Title | The general title of the alert. |
| Description | A more detailed description of the alert. |
| Latitude | The latitude of the location. |
| Longitude | The longitude of the location. |
| Direction | The direction of traffic flow affected by the alert. |
| Severity | The severity of the alert, from 1 (least severe) to 5 (most severe). |
| ReportDate | The date and time this incident was reported, in unix timestamp format. |
| UpdateDate | The date and time this incident was last updated, in unix timestamp format. |
| EndDate | The date and time this incident is scheduled to end, in unix timestamp format. |
| ImageUrl | If requested, the URL for an image corresponding to the location of the alert. |
The following is a sample response for the traffic problems around Yahoo! headquarters:
The Traffic Web Service is limited to 50,000 queries per IP address per day. See information on rate limiting.
The Traffic Web Service returns the standard errors. There are no service-specific errors.
Copyright © 2008 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings