【发布时间】:2015-03-18 09:11:22
【问题描述】:
我们有 json。在 json 中有 10 个纬度和 10 个经度。我们尝试在这些点之间画线。但是我们得到了状态代码 google.maps.DirectionsResult.MAX_WAYPOINTS_EXCEEDED。所以在删除了两个点之后。现在我们尝试在 8 个点之间画线,效果很好。但是在 json 中,有时会出现 50 到 100 个纬度和经度。我们尝试过这样
var aa=waypts[0].location.k;
var bb=waypts[0].location.D;
var cc=waypts[waypts.length-1].location.k
var dd=waypts[waypts.length-1].location.D;
var start1= new google.maps.LatLng(aa,bb);
var end1=new google.maps.LatLng(cc, dd);
var request = {
origin: start1,
destination: end1,
waypoints: waypts,
optimizeWaypoints: true,
travelMode: google.maps.TravelMode.DRIVING
};
debugger;
directionsService.route(request, function(response, status) {
debugger;
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
var route = response.routes[0];
}
});
首先告诉我如何在超过8个点之间画线。请指导我
【问题讨论】:
-
查看我在类似问题中的回答以及完整的代码示例stackoverflow.com/questions/8779886/…
标签: javascript google-maps google-maps-api-3 directions