我从一个文本框中得到了只有一个WAYPOINT的值,我尝试通过这个航路点从头到尾绘制一条路线,但它不起作用。
function calcRoute() {
var start = document.getElementById('start').value;
var end = document.getElementById('end').value;
var waypts = document.getElementById('way').value;
var request = {
origin: start,
destination: end,
waypoints: waypts
};
答案 0 :(得分:1)
waypts需要是DirectionsWaypoint objects
的数组function calcRoute() {
var start = document.getElementById('start').value;
var end = document.getElementById('end').value;
var waypts = document.getElementById('way').value;
var request = {
origin: start,
destination: end,
waypoints: [{location:waypts, stopover: true}]
};