Mystery Incorporated

Programming, photography, news, culture, and cartoons

home | rss | atom

Add to Google

Comparing Driving, Walking, Biking and Transit

December 17th, 2012 [programming]

modesGoogle maps gives you four options for showing directions: by car, by public transit, walking, and bicycling. My Side-by-Side Router shows all four at the same time.

Enter your starting and ending points. You can enter a specific address or any description that Google’s geocoder can figure out. The four routes are shown in different colors (in some cases they will overlap). Use the “steps” buttons to show pins at each step; clicking on the pins will show the specific directions for that step. Some cities will not have any transit information.

The screen also shows the estimated travel time and distance for each mode.

For quick demos, change the “anyplace” drop-down menu to a given town, for quick location choices.

Update: Thanks to a suggestion, I’ve simplified the user interface so instead of typing in addresses, all you have to do is click on the map. The drop-down on the right determines whether to just use the latitude & longitude coordinates, or to reverse-geocode to find an address. Geocoding adds a brief delay, and doesn’t always succeed in finding an address. If the result is too vague, some of the mode options may not be drawn.

You can also now drag the start and end point to adjust the routes’ endpoints.

The program was written in JavaScript, using the Google Maps API. I used their new feature for Styled Maps, which lets you control the map’s colors, line features, and which features get labels. I also used the Google Chart Tools to create custom pin colors. The routing decisions are made via a Google object belonging to their DirectionsRenderer class.

What would make the program more interesting or useful? Leave your thoughts in the comments below.

5 Responses to “Comparing Driving, Walking, Biking and Transit”

  • EJI says:

    Fantastic app. My only suggestion is providing an option to choose between miles and kilometers traveled.

  • Lucas says:

    I’d like to see the transit directions variable by time. Let me see the comparison on Sunday at 7pm vs. weekdays at 10am. Or at least tell me what time’s directions I see on the map. Is it the current time? Or is it some generic time.

  • Vasile says:

    Great work ! The only thing I miss is a permanent URL to the routes

  • Where are the public transit numbers? A colored line does not tell you which bus, tram, metro to take.
    Or, for that matter, a link to the times of operation and cost of a ticket.
    I asked for directions from Cap D’Ail to Casino Monaco. For this route
    there was NO public transit information at all! The Lignes D’Azure show that
    one can take bus 100 to Menton and get off at the Monte Carlo Casino and walk 3 mins to the casino and the
    fare is €1,5

  • Leave a reply

Site by M.V. Jantzen
mvs202 "at"