Tuesday, June 12, 2012

UK Post codes to latitude - longitude

Hi folks,

Apart from the conventional Google API for retrieving the latitude and longitude of any location by:

http://maps.googleapis.com/maps/api/geocode/json?address=<Address>&sensor=false

The above works quit beautifully for me. But the only problem was with its daily query limit. That is, you cannot make more than one particular number of calls to the above API from a single IP address.

So I started researching on other available API's for generating lat/lon from a given post code/city/town. Since my requirement was just for UK, so the following API URL came in very handy to me:


http://www.uk-postcodes.com/postcode/[postcode (no space)].['xml', 'csv', 'json'* or 'rdf']

A sample example would be

http://www.uk-postcodes.com/postcode/EC2N1HT.xml

In this the EC2N1HT is the UK post code without any space. I had used XML as the return type. But you can also use 'csv', 'json' or 'rdf'


The output I got looks like this:



Hope this was useful.

B'Bye

No comments:

Post a Comment