首页 新闻 会员 周边 捐助

如何向百度地图中插入多个点标记...

0
悬赏园豆:10 [已关闭问题] 关闭于 2014-12-02 15:49

向百度地图中插入多个点... 

这种写法貌似不行...

     求解释....

 1         var count = pointX.length;
 2         var polyArray = [];
 3         for (i = 0; i < count; i++) { 
polyArray[i] = new BMap.Point(pointX[i], pointY[i]); 7 } 8 var polyline = new BMap.Polyline(polyArray, 9 { strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5 }); 10 map.addOverlay(polyline);

这样子写就显示...
无语了...

 1         var x1 = pointY[0];
 2         var y1 =  pointX[0];
 3         var x2 = pointY[1];
 4         var y2 = pointX[1];
 5         var x3 = pointY[2];
 6         var y3 = pointX[2];
 7         var x4 = pointY[3];
 8         var y4 = pointX[3];
 9         var x5 = pointY[4];
10         var y5 = pointX[4];
11         var polyArray = [];
12         polyArray[0] = new BMap.Point(x1, y1);
13         polyArray[1] = new BMap.Point(x2, y2);
14         polyArray[2] = new BMap.Point(x3, y3);
15         polyArray[3] = new BMap.Point(x4, y4);
16         polyArray[4] = new BMap.Point(x5, y5);
17 
18         var polyline = new BMap.Polyline(polyArray, { strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5 });
19         map.addOverlay(polyline);

不知道哪里写的不对。。

没学过JS...

遥远的守望的主页 遥远的守望 | 初学一级 | 园豆:96
提问于:2014-12-02 15:22
< >
分享
所有回答(1)
0

... 

遥远的守望 | 园豆:96 (初学一级) | 2014-12-02 15:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册