2012-10-07 35 views
1

我有這個例子:超過2淵源和谷歌地圖API的目的地3

https://google-developers.appspot.com/maps/documentation/javascript/examples/directions-panel

,我想知道如何通過2個或多個航點設置路線?正如您在該應用程序中所瞭解的那樣,您可以獲取路點:首先,設置原點/起點,然後設置目的地點,地圖將生成路線。腳本:

 function calcRoute() { 
    var start = document.getElementById('start').value; 
    var end = document.getElementById('end').value; 
    var request = { 
     origin: start, 
     destination: end, 
     travelMode: google.maps.DirectionsTravelMode.DRIVING 
    }; 
    directionsService.route(request, function(response, status) { 
     if (status == google.maps.DirectionsStatus.OK) { 
     directionsDisplay.setDirections(response); 
     } 
    }); 
    } 

請參閱:origin:start,destination:end。

現在的問題是:我可以自己設定航點嗎?從點到點使用LatLong,或者我只是說出什麼是街道名稱?

明白嗎?對不起,我不善言辭,但我總是等待答案,謝謝!

回答

0
+0

你的意思是? :起源:「華盛頓州西雅圖市9840號西北第54街1521號」 –