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
- Flickr Original updates
(Saturday 08/7/2010 – 7 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 48 Comments) - WWDC 2010: Worth Every Minute
(Monday 06/14/2010 – No Comments) - Flickr Original for Safari 5!
(Wednesday 06/9/2010 – 26 Comments)
