Tag Archives: Driving distance

Using Google to Calculate Driving Distance / Time in PHP

A common problem for programmers is to calculate the straight line distance between two points given coordinates (lon / lat or easting / northing) and is trivial to solve. A less simple task is calculating the road distance between two addresses / postcodes / sets of coordinates.

But, as usual, Google can do this with ease and while it does not allow this functionality for every country in it’s API it is very simple to scrape the required information from their html service that they provide to everyone.