Yahoo! is shutting down the Traffic Rest API and the Traffic RSS Feed. There is no transition to a new or existing Yahoo! Traffic API at this time. Although the current APIs are going away, we will announce improvements to our Maps APIs in early 2011, which will include updated traffic features.
The Traffic Web Services from Yahoo! enable you to get traffic alert information from a given location. The Traffic RSS feed is a dynamically-generated feed; start with the base URL, add parameters for your location and other details and get back just the information you wish to see.
Traffic Web Services are also available through the Traffic REST API.
The dynamic Traffic RSS feed begins with the base RSS URL:
http://local.yahooapis.com/MapsService/rss/trafficData.xml?
To this URL, add parameters to customize the feed for your location or application. The feed parameters have the form parameter=value. All values must be URL encoded . The appid parameter is required for all feed requests. For example, to get a Traffic alert feed for the zip code 94043, use this URL:
http://local.yahooapis.com/MapsService/rss/trafficData.xml?appid=YdnDemo&zip=94043
For the traffic alerts in and around Yahoo! Headquarters in Sunnyvale, use this URL:
See Request Parameters for the available dynamic feed parameters.
Yahoo! Maps returns an RSS 2.0 feed in response to this request. You can subscribe to this URL from My Yahoo! or another RSS feed aggregator, or you can incorporate the information in the RSS feed into your own application. See Response Elements for information on the elements contained in the RSS feed.
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 |
Use location to enter city, state or zip code information in any of the following free-text formats:
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 or 1 | Always 1; an image is always returned. |
image_type | png (default) or gif | The image format for the map. |
image_height | integer: 10 to 2000 (default: 500) | The height of the image being generated, in pixels. |
image_width | integer: 10 to 2000 (default: 620 | The width of the image being generated, in pixels. |
The Traffic RSS response is an XML document that conforms to the RSS 2.0 specification. Additional elements from the geo vocabulary are also included. Traffic RSS is an XML document containing a single channel element representing the feed, several elements containing metadata about the feed itself, and one or more item elements describing individual items within the feed.
Element | Description |
---|---|
rss | Topmost enclosing element. Traffic RSS conforms to RSS 2.0. Child elements: channel |
The channel element contains metadata about the feed and its contents.
Element | Description |
---|---|
title | The title of the feed, for example "Yahoo! Traffic Alerts." |
link | The URL of Yahoo! Maps (http://maps.yahoo.com) |
language | The language of the alert (en for English) |
description | The description of the feed, for example, "Traffic Alerts." |
copyright | The Yahoo! copyright statement for this feed. |
lastBuildDate | The last time data for this location was updated, in the date format defined by RFC822 Section 5, for example Mon, 256 Sep 17:25:18 -0700. |
image | The image used to identify this feed. See Image Elements for element descriptions Child elements: url, title, link, width, height |
item | A traffic alert. Each location feed contains multiple item elements for each alert. See Item Elements for element descriptions. Child elements: title, link, description, geo:lat, geo:long, guid, pubDate |
The image element describes an image or icon used to identify the feed.
Element | Description |
---|---|
title | The title of the image, for example "Yahoo! Maps" |
link | The URL of the site the feed refers to, for example, Yahoo! Maps (http://maps.yahoo.com) |
url | The URL of the image |
width | The width of the image, in pixels |
height | The height of the image, in pixels |
Element | Description |
---|---|
title | The general title of the alert. |
link | The URL of the map image for the alert. The image is included regardless of whether the include_image parameter is 1 or 0. |
description | The detailed description of the alert. |
item | A traffic alert. Each location feed contains multiple item elements for each alert. Child elements: title, link, description, geo:lat, geo:long, guid, pubDate |
geo:lat | The latitude of the location. |
geo:long | The longitude of the location. |
guid | Unique identifier for the item. For alerts the guid is a link to the map image representing the item and has the same value as the link element for the item. |
pubDate | The date and time this incident was reported, in the date format defined by RFC822 Section 5, for example Mon, 256 Sep 17:25:18 -0700. |
To request an RSS feed of possible traffic alerts around Yahoo! Headquarters in Sunnyvale, CA, use this request: http://local.yahooapis.com/MapsService/rss/trafficData.xml?appid=YdnDemo&street=701+First+Avenue&city=Sunnyvale&state=CA
The response is shown below:
The Traffic RSS Feed is limited to 50,000 queries per IP address per day. See information on rate limiting.
The Traffic RSS Feed returns the standard errors. There are no service-specific errors.