Database Reference
In-Depth Information
Exceptional Circumstances
To ensure that our script runs smoothly, we need to deal with the possibility that an address
cannot be geocoded or that our conversation with the geocoder will be interrupted.
The Unmappable Fake Street
Now we have to deal with the problem of bad street addresses—either the sheriff's office
entered a typo or our parser let a bad street address pass (see http://local.yahooapis.com/
MapsService/V1/geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--
&street=1+Fake+St&city=Philadelphia&state=PA ).
The Yahoo documentation states that when confronted with an address that cannot be mapped,
the geocoder will return coordinates pointing to the center of the city. Note the precision
attribute of the result is “zip” instead of address and there is a warning attribute as well:
<?xml version="1.0"?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:maps"
xsi:schemaLocation=
"urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/
GeocodeResponse.xsd">
<Result precision="zip"
warning="The street could not be found. Here is the center of the
city.">
<Latitude>39.952270</Latitude>
<Longitude>-75.162369</Longitude>
<Address>
</Address>
<City>Philadelphia</City>
<State>PA</State>
<Zip></Zip>
<Country>US</Country>
</Result>
</ResultSet>
Paste in the following:
> street<-"1 Fake St"
> requestUrl<-paste(
"http://local.yahooapis.com/MapsService/V1/geocode?appid=",
appid,
"&street=",
URLencode(street),
Search WWH ::




Custom Search