我目前正在更新gmaps V2到版本3. 到目前爲止,它大部分都很不錯,但我堅持這一點。如何獲得乘坐渡輪和汽車的路線? GMAPS
我需要一條將通過渡輪旅行的路線,但我的旅行模式設置爲駕駛。 我有一個路線總是使用路線,但因爲它忽略了大海,它會到達我的航點,然後返回一點去使用橋樑在水上行駛。
澄清: 用戶指定一個城市從-----經過標準航點---->使用渡輪在海上旅行---> conntinnues開車到目的地。
我的問題很簡單,gmaps忽略大海,並發現有橋樑的路線,而不是。
代碼:
<asp:PlaceHolder ID="International" runat="server" visible="false">
/*Ferry is required*/
viaAddress = document.getElementById('viaAddress').value;
var noOfPoints = 4;
var waypoints = new Array(noOfPoints);
waypoints[0] = fromAddress;
if (viaAddress == 'Rostock')
waypoints[<%=GetVia(1) %>] = '55.366936,13.151429'; //(Trelleborg - Rostock) 55.372387,13.149916
else
waypoints[<%=GetVia(1) %>] = '55.368844,13.151515';
waypoints[<%=GetVia(2) %>] = viaAddress;
waypoints[3] = '<%=GetToAddress() %>';
</asp:PlaceHolder>
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(mapdir);
gdir.route({
origin: waypoints[0],
destination: waypoints[3],
waypoints: [{
location: waypoints[1]
}
],
provideRouteAlternatives: false,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
如果ANY1問: 這不是一個腳本文件,我「繼承」從以前那樣像這樣幾年經驗豐富的開發這個任務,不要問我爲什麼。
我一直在尋找如何做到這一點的網,但我還沒有想出什麼,一直在讀,沒有運氣以下:
https://developers.google.com/maps/documentation/javascript/directions?hl=sv https://developers.google.com/maps/documentation/javascript/reference#DirectionsWaypoint
如果有人在那裏有答案即時通訊非常感謝,並會很感激,如果我可以得到一些鏈接,以便我可以讀到這一點。
謝謝!
我假設碰撞會被視爲垃圾郵件,但是......任何人? 我試着將水放在水面上,但它仍然不會乘渡船。 – ThunD3eR