Postcode distance calculator with Googlemaps
August 7, 2008
I was having a discussion with a guy at work today who seemed convinced that you couldn’t create a distance calculator using GoogleMaps because the UK postcode databases are copyrighted. You can I said, quite sure of myself… because I have.
The link below uses the basics (haversine formula) provided by P Jenkins but instead of some dodgey old database I’ve used the longitude and latitude provided by a Google GeoPos search… my version calculates the distance in Miles based upon the radius of the Earth provided my wikipedia from a postcode just north of London. It was originally created for a client some time ago but never got used. Please feel free to rip off as much as the code I have - have fun (obviously apply for your own google maps api.