我使用Here Maps的Javascript API。我该如何以编程方式添加多个路标点?我尝试了以下代码:
var via = new Array();
var len = waypoints.length-1;
for(var i = 1; i < waypoints.length-1; i++){
via.push("waypoint" + i + ":" + waypoints[i][0] + "," + waypoints[i][1] + ",");
//console.log(waypnts);
}
console.log(via);
var router = platform.getRoutingService(),
routeRequestParams = {
mode: 'fastest;truck;',
grossWeight: '40',
height: '4.0',
width: '2.55',
length: '18.25',
axleCount: '5',
excludecountries: 'CHE',
representation: 'display',
alternatives: '3',
routeattributes : 'waypoints,summary,legs',
maneuverattributes: 'direction,action',
//RouteRepresentationModeType:'dragNDrop',
start:waypoints[0][0] + "," + waypoints[0][1],
destination:waypoints[len][0] + "," + waypoints[len][1]
};
我尝试通过routeRequestParams添加变量via,但没有成功。