UK Post Code Distance Calculation in PHP
I have always wondered how some websites calculate distance between post codes. A new project came along which needed to calculate the distance between 2 post codes.
The solution is basically a database or CSV of post codes, each record will contain the first part of the postcode and the latitude and longitude. What you will need is the SQL file or the CSV file and a bit of old school mathematics. I have also included the county or area in both SQL and CSV, you will not need these, but I have included them anyway as they might help you. (more…)
13 Comments