百度地图android海量点卡顿,百度地图加载海量点

//初始化坐标点

function initCoordinateInfo(){

$.ajax({

url: "url",

async: true,

method: ‘GET‘,

dataType: "json",

cache: false,

success: function (result) {

// console.log(map.getZoom());

//显示海量点

if (map.getZoom() <= 12) {

//海量点数据

points = [];

// 添加海量点数据

for(var i = 0; i < result.data.length; i++){

var p =new BMap.Point(result.data[i].mapX, result.data[i].mapY);

p.type= result.data[i].type;

points.push(p)

}

mapOverlay();

} else {

map.clearOverlays();

var allOverlay = map.getOverlays();

for (var i = 0; i < allOverlay.length; i++) {

//console.log(allOverlay[i]);

if (allOverlay[i].__proto__.wQ == "PointCollection") {

map.removeOverlay(allOverlay[i]);

}

}

}

}

})

}

//把海量坐标绘制到地图上

function mapOverlay11(type) {

//坐标点样式

var options = {size: BMAP_POINT_SIZE_SMALL, shape: BMAP_POINT_SHAPE_CIRCLE, color: ‘#0000EE‘}

//创建pointCollection

pointCollection = new BMap.PointCollection(points, options);

//添加点击控件

pointCollection.addEventListener("click",function(e){

var content = "这是弹窗信息"

var point = new BMap.Point(e.point.lng, e.point.lat);

var opts = {

width: 250, // 信息窗口宽度

height: 70, // 信息窗口高度

//title:"", // 信息窗口标题

//enableMessage: false,// 设置允许信息窗发送短息

}

var infoWindow = new BMap.InfoWindow(content); // 创建信息窗口对象

map.openInfoWindow(infoWindow,point); //开启信息窗口

});

// 添加Overlay

map.addOverlay(pointCollection);

}

原文:https://www.cnblogs.com/LinTianwen/p/12504113.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值