Google Maps API Tutorial

© 2007 Mike Williams

 

Get Directions on your own map

It is now possible to obtain directions on your own map.

Here's an example.

I've tried to make the "Get Directions" option look as much like the one in the info window of the real Google page as possible. There are initially two links: "To here" and "From here". Clicking these links opens a corresponding form.

The initial version of the info window, one with the "To here" form and one with the "From here" form. When the "To here" or "From here" link is clicked, the corresponding html string is loaded into the info window.

When the "Get Directions" button is clicked, the form invokes the "getDirections()" function which makes a GDirections() call.

The details of using GDirections() is well described in the Official Documentation, so I'll not repeat the information here.

Potential Pitfalls

  1. GDirections() doesn't currently support queries in the form "43.82589,-79.1004(My House)".
    It does support the format "My House@43.82589,-79.1004".
  2. Remember to activate VML so that GDirections can plot the polyline in MSIE.

Here's an example of multi-point routing on your own map.

Back to Mike's Homepage
Up to the start of this tutorial