Page 1 of 1

Distances between UK postcodes

Posted: Sat May 22, 2004 4:43 am
by starsol
I've seen a lot of website that have a feature to work out the distance between two UK postcodes. (For example on an estate agency website, you can search for houses within 50 miles of a certain postcode).

I imagine this works by having every UK postcode is stored in a database with a grid reference, and working out the distance 'as the crow flies' between the two grid reference points.

Does anyone know of anywhere that I could get hold of such a database? Also, can anyone advise on a function for working out the distance between two grid reference points?

Posted: Sat May 22, 2004 4:57 am
by launchcode
Working out the distance is actually the easy part - it's a simple triangulation. The problem is getting the post codes in the first place - most of the large sites will subscribe to the Royal Mail Postcode Index, where they are issued complete and accurate listings with regular updates in a format they can import to their databases, etc.

Be warned - this is VERY expensive :(

Posted: Sat May 22, 2004 8:03 am
by mjseaden
starsol - I know someone who's site uses such a system - it costs around £1000/year. As for the maths, you need to use pythagoras. Look this up on google, if you've got minimal algebra skills it shouldn't be too much of a problem.

Mark