The Yahoo Geocoding API
Currently, the Yahoo Geocoding API (http://developer.yahoo.net/maps/rest/V1/geocode.html) is really useful only for geocoding addresses in the United States, though with competition from Google, we're sure this will change. Before Google's geocoder came along, this was the geocoder of choice for many people doing US-centric mashups using both the Google Maps API and the Yahoo Maps API. The only real limitation is that you can make only 5,000 lookup requests per day (per IP address).
â– Caution The rate limit for Yahoo is based on a 24-hour window, not a calendar day. This window begins when you first send a request to the service and is reset 24 hours later. Also the window does not "slide" (as it does with other services), meaning that it's not a count of the requests made in the last24-hours, but rather a fixed time frame. For a more thorough explanation of the rate limiting in the Yahoo Geocoding Web Service, please visit http://developer.yahoo.net/search/rate.html.
To use the API, you must register for a Yahoo application ID (like the Google API key you received in Chapter 2). To obtain your application ID, visit http://api.search.yahoo.com/ webservices/register_application after logging in to your Yahoo account. If you do not have a Yahoo account, you'll need to create one before proceeding. Once you have your application ID, you'll need to include it in the requests to the service.
Like the Google geocoder, the Yahoo service is REST-based and requires you to append URL-encoded parameters onto the end of the request URL, as listed in Table 4-2.
|
Parameter |
Value |
Description |
|
appid |
String (required) |
The application ID you obtained from Yahoo. |
|
street |
String |
The name and number of the street address. The number is optional but can improve accuracy. |
|
city |
String |
The name of the city or town. |
|
state |
String |
The name of the state, either spelled-out in full or as the two-letter abbreviation, which is more accurate. |
|
zip |
Integer |
The five-digit ZIP code. This could also be a string of five digits, a dash, and the four-digit extension. |
|
location |
String |
A free-form string representing an address.* |
|
output |
String |
The format for the output. Possible values are xml (the default) or php. If php is requested, the results will be returned in serialized PHP format. |
*The location parameter overrides the street, city, state, and zip parameters, and allows you to enter many different common formats for addresses. Thus, you are relying on Yahoo to parse the string accurately and as you intended, much like the Google service does. Yahoo's geocoder is quite good at doing this parsing (for the same reasons as Google's geocoder), so unless you already have the data broken out into components, your best bet might be to use the single location parameter instead of the individual parameters.
*The location parameter overrides the street, city, state, and zip parameters, and allows you to enter many different common formats for addresses. Thus, you are relying on Yahoo to parse the string accurately and as you intended, much like the Google service does. Yahoo's geocoder is quite good at doing this parsing (for the same reasons as Google's geocoder), so unless you already have the data broken out into components, your best bet might be to use the single location parameter instead of the individual parameters.
Post a comment