Finding distance and time between two places with Google Maps
Wednesday 11/19/2008 – Category: Uncategorized
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
Recent Posts
- Marble Paint
(Friday 02/4/2011 – 1 Comment) - More Flickr Original Updates
(Sunday 01/23/2011 – 13 Comments) - Flickr Original updates
(Saturday 08/7/2010 – 19 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 65 Comments)
