The project I'm working on at the moment requires the ability to get geographic coordinates for a location, otherwise known as "Geocoding". Previously you used to have to pay for the ability to do that in the UK (since the Ordinance Survey owned the copyright to the postcode information, I believe). However of late they've made that information open source (you can even download their maps database(s) for free!) which means that there are a couple of free tools around to help you out.
I was after a solution that would let me pass in a pretty unscructured string (I don't want to ask my users for a full address - a postcode like "SW1A 2AA" should be just as valid as "London") and get a result. I also wanted to use a REST service (which basically means you can get your result from a single web URL) for simplicity.
The three main contenders would be Google's Geocoding API, Yahoo's Placefinder API and Microsoft's Bing Map's API. We decided against Bing because of the potential costs involved, so I decided to do a little compare and contrast between Google and Yahoo's geocoding offerings.
Usage / license
The Google API's usage limits allow 2,500 requests a day for free (or you can get 100,000 a day by signing up to a business API model for $10k USD a year) and the result of your lookup must be displayed on a Google map. Yahoo's service offers 50,000 lookups a day and has no such restriction on what you do with the data.
2,500 lookups a day is one every 35 seconds (or so), whereas 50,000 is one lookup every 1.7 seconds! More lookups for free per day from Yahoo ... plus one to Placefinder.
Features
Both APIs offer pretty similar base functionality: Results are returned in JSON or XML formats and reverse geocoding is supported by both (finding an address from coordinates rather than the other way 'round). Yahoo's API's request format gives you a lot more options for what you're searching for. You can specify parts of the address if you want to, and you can use flags to only return the coordinates if you don't want the street address.
So being able to specify exactly what I want back from Yahoo - that'd help reduce the bandwidth used ... that's two up for Yahoo.
Accuracy
Then, however, I thought I'd check the accurracy of the results returned - and I may have found a potential "gotchya". Searching on the same postcode, Google and Yahoo are returning different locations. Time to look deeper (look for the green pins in the links below):
- 10 Downing Street: Google got it spot on but Yahoo places the address in Whitehall.
- M&S Oxford Street: Google is spot on but Yahoo is a block out.
- Edinburgh Waverly rail station: Google is spot on again and Yahoo gets it right too (the location is different, but that station is huge).
- The Nightingale club in Birmingham: Google is over the road but Yahoo is half a street away.
- Windsor farm shop: both Google and Yahoo got it wrong (the location is here), however I imagine that postcode is shared between quite addresses on that street.
They were all locations chosen relatively randomly. Although there's not too much in it, Yahoo is consistently off the mark, which I have to admit is a little disappointing. It's true I haven't tested any locations / postcodes in more rural areas or tested more general searches (such as "Westminster", "Canary Wharf" or even "London"), but I've run out of time for today.
Besides, the decision on which to go for isn't mine - I'll leave that in the capable hands of the project manager. ;)
No comments:
Post a Comment