有谁知道为什么这个特定的折线被绘错了? 通常情况下工作正常,但对于这次旅行我现在已经有了想法! 测试网站:http://junkvibration.com/test/walk/test.htm
感谢您的帮助!
我对这个例子的观点是:
waypoints: [{location:"Lucern",stopover:false},{location:"Paris",stopover:false},
{location:"Madrid",stopover:false},{location:"Granada",stopover:false},
{location:"Barcelona",stopover:false},{location:"Monaco",stopover:false},
{location:"Rom",stopover:false}],
optimizeWaypoints: false,
travelMode: google.maps.DirectionsTravelMode.WALKING };
答案 0 :(得分:2)
看起来像DirectionsService中的一个错误。
如果我制作了所有航路点{stopover:true}那么它就可以了。
function calcRoute() {
var request = {
origin: "Bad Aussee",
destination: "Rottenmann",
waypoints: [{
location:"Lucern",
stopover:true
},{
location:"Paris",
stopover:true
},{
location:"Madrid",
stopover:true
},{
location:"Granada",
stopover:true
},{
location:"Barcelona",
stopover:true
},{
location:"Monaco",
stopover:true
},{
location:"Rom",
stopover:true
}],
optimizeWaypoints: false,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
alert("Directions request failed: "+status);
}
});
}
working example - stopover:true
not working (ZERO_RESULTS) - stopover:false, same request as above otherwise
example tries the same request first with stopover:false (fails), then with stopover:true (succeeds)
walking directions (UNKNOWN_ERROR with stopover:true, weird path with stopover:false)
walking directions using multiple requests to the DirectionsService - 更好,但似乎要我从摩纳哥游到罗马......