1 driving = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}}); 2 for (var i=0;i<points.length-1;i++){ 3 driving.search(points[i],points[i+1]); 4 } 5 6 driving.setSearchCompleteCallback(function(){ 7 pts = driving.getResults().getPlan(0).getRoute(0).getPath(); 8 polyline = new BMap.Polyline(pts,{strokeColor:"blue",strokeWeight:3,strokeOpacity:0.8}); 9 map.addOverlay(polyline); 10 });