Google maps 谷歌地图的局限性
我不能在谷歌地图上建立超过10条路线,但我认为在文档中没有找到对路线数量的限制,在中间点上有限制(8)。那会是什么问题呢Google maps 谷歌地图的局限性,google-maps,Google Maps,我不能在谷歌地图上建立超过10条路线,但我认为在文档中没有找到对路线数量的限制,在中间点上有限制(8)。那会是什么问题呢 function requestDirections(start, end, polylineOpts, ways, image) { if (ways.length > 0) { var waypts = []; for (var i = 0; i < ways.length; i++) {
function requestDirections(start, end, polylineOpts, ways, image) {
if (ways.length > 0) {
var waypts = [];
for (var i = 0; i < ways.length; i++) {
waypts.push({
location: ways[i][0] + ", " + ways[i][1],
stopover: true
});
}
directionsService.route({
origin: start,
destination: end,
waypoints: waypts,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function (result) {
renderDirections(result, polylineOpts, image);
});
} else {
directionsService.route({
origin: start,
destination: end,
//waypoints: waypts,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function (result) {
renderDirections(result, polylineOpts, image);
});
}
}
function beretCoordinate() {
var routesId = document.getElementsByName('routesId');
var k = 0;
for (var i = 0; i < routesId.length; i++) {
var routesId2 = routesId[i].value.replace('~', '').split(',');
var startMassiv = 0;
var index = 0;
var mapPoints = document.getElementsByName(routesId2[0]);
var start;
var end;
for (var j = 0; j < mapPoints.length; j++) {
routes[j] = mapPoints[j].value.replace(',', '.').replace(',', '.').replace('+', ',').replace('+', ',').replace('+', ',').split(',');
if (i >= routesId.length) {
pointsMap[k]=[routes[j][0], routes[j][1], routes[j][2]];
k++;
//marshrutCount++;
} else {
if (startMassiv == 0) {
var startRoute = routes[j];
end = startRoute[0] + ", " + startRoute[1];
} else {
if (startMassiv == 9 || startMassiv == mapPoints.length - 1) {
var endRoute = routes[j];
start = endRoute[0] + ", " + endRoute[1];
var icons2 = {
link: new google.maps.MarkerImage(
// URL
routes[j][2],
// (width,height)
new google.maps.Size(50, 50),
// The origin point (x,y)
new google.maps.Point(0, 0),
// The anchor point (x,y)
new google.maps.Point(25, 46)
)
};
//calcRoute(start, end, findRoutes);
requestDirections(start, end, { strokeColor: routesId2[1] }, findRoutes, { icon: icons2.link });
//DrawRoute(findeRoutes, "red");
startMassiv = -1;
index = 0;
findRoutes = [];
//marshrutCount++;
} else {
findRoutes[index] = routes[j];
index++;
}
}
startMassiv++;
}
}
}
}
函数请求方向(开始、结束、多段线选项、方式、图像){
如果(路径长度>0){
var-waypts=[];
for(var i=0;i=路由ID.长度){
pointsMap[k]=[路由[j][0],路由[j][1],路由[j][2];
k++;
//marshrutCount++;
}否则{
如果(startMassiv==0){
var startRoute=路线[j];
结束=星型[0]+“,”+星型[1];
}否则{
if(startMassiv==9 | | startMassiv==mapPoints.length-1){
var endRoute=路线[j];
start=endRoute[0]+“,”+endRoute[1];
变量icons2={
链接:新建google.maps.MarkerImage(
//网址
路线[j][2],,
//(宽度、高度)
新google.maps.Size(50,50),
//原点(x,y)
新的google.maps.Point(0,0),
//锚点(x,y)
新谷歌地图点(25,46)
)
};
//卡尔克劳特(起点、终点、终点);
requestDirections(开始、结束,{strokeColor:routesId2[1]},FindLotes,{icon:icons2.link});
//提取路线(FinderRoutes,“红色”);
startMassiv=-1;
指数=0;
芬杜洛特群岛=[];
//marshrutCount++;
}否则{
Findrootes[指数]=路线[j];
索引++;
}
}
startMassiv++;
}
}
}
}
方向服务受配额和费率限制的限制,如墙
检查方向请求返回的状态:
function requestDirections(start, end, polylineOpts, ways, image) {
if (ways.length > 0) {
var waypts = [];
for (var i = 0; i < ways.length; i++) {
waypts.push({
location: ways[i][0] + ", " + ways[i][1],
stopover: true
});
}
directionsService.route({
origin: start,
destination: end,
waypoints: waypts,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function (result, status) {
if (status == google.maps.DirectionsStatus.OK) {
renderDirections(result, polylineOpts, image);
} else {
alert("Directions request failed:"+status);
}
});
} else {
directionsService.route({
origin: start,
destination: end,
//waypoints: waypts,
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function (result,status) {
if (status == google.maps.DirectionsStatus.OK) {
renderDirections(result, polylineOpts, image);
} else {
alert("Directions request failed:"+status);
}
});
}
}
函数请求方向(开始、结束、多段线选项、方式、图像){
如果(路径长度>0){
var-waypts=[];
for(var i=0;i
渲染方向是什么样子的?您正在检查请求的状态吗?它可能超过了极限