Menus and listings for all Edinburgh restaurants, cafes and takeaways

Geocoding Problems

On EdinburghMenus.com, it’s really easy to find businesses located close to where you are — you can enter an Edinburgh postcode, street name, area or city landmark.

You may think that such functionality is very straightforward to implement but that is not necessarily the case, certainly not in the UK.

In the UK the Post Office owns the postcode data and sells that information to people who need it. There is an attempt to produce a public domain version of that data, but that is going to take a while. In order to get around this, EdinburghMenus.com used to approximate the location of a postcode by comparing it with a postcode for one of the over 800 businesses we have in our database. This wasn’t ideal, as it didn’t give an entirely accurate location, but it was quick and, most importantly free. Then Google enabled UK geocoding in their GoogleMaps API and all was well — you could send a UK postcode to Google and they would return the precise coordinates for that location.

But how did Google get around the licensing implications of UK postcodes and give away this data to web developers for free? Well, it looks like they didn’t — as of the middle of last week, geocoding a UK postcode with the GoogleMaps API no longer works. Hummmph. It looks as if it was a mistake on Google’s part to enable it in the first place.

As a result of this, locating postcodes was broken for a while on EdinburghMenus.com. We have now found an alternative solution from Emad Fanous which is working well so far, although it is not quite as quick as the Google solution. We’ve also adapted our code so that if Google ever do re-enable their UK postcode Geocoding, the system will use that instead and if Emad Fanous’ version stops working, the site will revert to approximating postcodes from data within our own database.

One Response to “Geocoding Problems”

  1. emad Says:

    Hi all,

    I’m glad you found the geocoding useful. The server has been getting pounded but the biggest bottleneck right now is bandwidth. You can always request the page with an “Accept-Encoding” that includes various compression (i.e. gzip’ed, etc) and you can pull the data down slightly faster.

    Best of luck
    Emad

Leave a Reply

About the blog
Search