日期:2014-05-16 浏览次数:20398 次
function callback(xyResults){
var xyResult = null;
for(var index in xyResults){
xyResult = xyResults[index];
if(xyResult.error != 0){continue;}//出错就直接返回;
var point = new BMap.Point(xyResult.x, xyResult.y);
var marker = new BMap.Marker(point);
map.addOverlay(marker);
map.setCenter(point);// 由于写了这句,每一个被设置的点都是中心点的过程
}
}
setTimeout(function(){
BMap.Convertor.transMore(points,0,callback); //一秒之后开始进行坐标转换。参数2,表示是从GCJ-02坐标到百度坐标。参数0,表示是从GPS到百度坐标
}, 1000);
var i = 0,point = [1,2,3,4,5],step=2;//定义起始点i,point为坐标数组,step每次发送个数
function callback(xyResults){
var xyResult = null;
for(var index in xyResults){
xyResult = xyResults[index];
if(xyResult.error != 0){continue;}//出错就直接返回;
var point = new BMap.Point(xyResult.x, xyResult.y);
var marker = new BMap.Marker(point);
map.addOverlay(marker);
map.setCenter(point);// 由于写了这句,每一个被设置的点都是中心点的过程
}
i = i + step;
if(i>point.length){//超过数量则直接return
return;
}
var points = point.slice(i,i+step);//取出本次要发送的坐标数组
BMap.Convertor.transMore(points,0,callback)
}
var points = point.slice(i,step);取出第一次要发送的坐标数组
BMap.Convertor.transMore(points,0,callback);