Search Along A Driving Route

April 19, 2007

I recently went on a 3000 mile road trip, and as I was preparing for the trip, I wanted to know the answer to questions like “Where are all the Speedway gas stations that are within a mile of my route?”. I couldn’t find anything that would allow me to search for businesses near a given driving route, instead I could only search for things near a given point or city. I decided to build a mashup using Yahoo! Pipes and Google Maps that would allow me to do just what I wanted.

How to use it:

  1. Install the search-route bookmarklet.
  2. Go to Google Maps and create route.
  3. Click the search-route bookmarklet you installed in step #1.
  4. Search!

If you don’t want to bother installing the bookmarklet and want to try out the searching, you can test a local driving route or a long distance driving route.

How it Works:

After the user creates the route on Google Maps, clicking the bookmarklet sends the URL of their Google Maps page to a script on my site. This script will download the URL from Google Maps and parse out the encoded route in that page. Once we have this, we can give the user a search page with their route and map using Google Maps’ API. When the user searches, we call a Yahoo! Pipe which is passed the search parameters and a special id referencing this user’s route. The Yahoo! Pipe will download a specially crafted Atom feed for this route from my server. This Atom feed contains a list of some of the latitude and longitude points of the route. The Yahoo! Pipe then does a Yahoo! Local search on each point using the search parameters the user specified. Searches on particularly long routes can take several seconds to complete.