前からグーグルマップで地図にルート案内を付けたかった
のでこの情報はありがたいですひらめき電球

Google Map APIでルート表示をする

ルートポイントの指定
function plotRoute(overlay, latlng) {
// Create a new marker based on the coordinates
var marker = new GMarker(latlng);

// Instantiate the GDirections class
var directions = new GDirections(map);

// Add the new marker to the map
map.addOverlay(marker);

// Create the new array element
coordinates_array_element = latlng.lat() + "," + latlng.lng();

// Add the new array element to the map
coordinates.push(coordinates_array_element);

// If > one point on the map, plot the route between these two points
if (coordinates.length > 1) {
directions.loadFromWaypoints(coordinates);
}
}

呼び出し
GEvent.addListener(map, "click", plotRoute);


高速道路を回避したり、地点から次の地点まで
ユーザーに道案内を表示したり、距離の移動時間
を計算する方法も紹介されているので参考になりますニコニコ

Google Map APIでルート表示をする