Instead of doing ghetto (and inaccurate) coordinate math, let's use Google Maps to do the work. This is a bit obscure, but you can append &output=kml to any search query and it will give you output in KML (XML for Google Earth) which makes scraping just a tad bit cleaner.

Instead of parsing the XML, I chose the quick and dirty way of isolating the distance and time.

To calculate DISTANCE, pass 1 as the first argument. To calculate TIME, pass 2.

CAVEAT: If Google Maps can't find your start or end address, it will output an empty file.

Leave a Reply