post code searching

Permabanned
Joined
25 Oct 2004
Posts
9,078
Planning to implement a feature on our website (charity based organisation) to allow people to search for the nearest branch based on their postcode.

I've had a look around but postcode databases appear to cost an arm and a leg and its not something i could get funding for to buy! anyone know of a free UK postcode database available ?

preferably one with inner and outer postcodes ie XX1 1XX as apposed to just XX1.

cheers
 
Already used the google route could only find data based on the initial part of postcodes not the complete thing.

Reason is we have over a dozen branches in 3 towns, i'd like to implement a system where people can put their postcode into our website and get the nearest branch. Along with a map showing its exact location. Its possible with just the first part of a postcode but its not accurate as for example TQ1 covers a very large area in torquay.
 
sorry to be a bit negative but with there only being 12 branches (assuming i read that right) i would just list the 12 branches and then if they so wish plot the branches using google maps to show them where they are exactly.

ive done similar to what you did but with a load of database work by others first, Mapping each postscode to a branch etc etc and i just did the implementation.
 
I know that would be a lot easier to implement, but from a personal side I wanna do it just to see if I can, if you know what i mean.

The php/sql side wont be an issue but need the post code data to make it work properly as its something that could then be used by other branches in different counties.
 
I know it's not exactly what you want but I've used this which goes to 4 places.

As this gives you the coordinates of each postcode you just need to work out the distance between the coordinates using any of the below formulas (Vincenty is the most accurate I believe) and then order by distance to get the closest branch(s).

http://en.wikipedia.org/wiki/Vincenty's_formulae
http://en.wikipedia.org/wiki/Haversine_formula
http://en.wikipedia.org/wiki/Great-circle_distance


There's some algorithms here:
http://www.movable-type.co.uk/scripts/latlong.html

If you're using Microsoft SQL Server I'll dig out the greater circle formula we use if you like.
 
Last edited:
Hi,
I did a application for a customer who needed a postcode lookup. He had to pay £1000 per year I think? You can use Google maps api but it only uses the first 3 values to get around the royal mail fees. The Google API will get you close but my customer wonted GPS values.

He told me that the fee would be reduced if the application limited the search for each location. I can not remember exactly how the licensing worked. I still have the database on. Its an 8GB table.

I also used this site to do journey planning:

www.transportdirect.info/transportdirect/en/journeyplanning/jplandingpage.aspx

FredFlint.
 
Hi,
You can use Google maps api but it only uses the first 3 values to get around the royal mail fees. The Google API will get you close but my customer wonted GPS values.

That's true for the Google Maps API but the Google Local Search API will work for both parts of the postcode, not just the first.
 
Back
Top Bottom