题目描述
百度地图API使用海量点的Demo。无法显示海量点。
在地图上面需要把人员所在的点都描绘出来。使用百度地图API的海量点来实现。
if (document.createElement('canvas').getContext) { // 判断当前浏览器是否支持绘制海量点
 var points = []; // 添加海量点数据 
 angular.forEach(result,function(data,index,array){
 if(data.longitude && data.longitude>0 && data.latitude && data.latitude>0){
 points.push(new BMap.Point(data.longitude, data.latitude)); 
 }
 });
 var options = {
 size: BMAP_POINT_SIZE_SMALL,
 shape: BMAP_POINT_SHAPE_STAR,
 color: '#d340c3'
 }
 var pointCollection = new BMap.PointCollection(points, options); // 初始化PointCollection
 pointCollection.addEventListener('click', function (e) {
 alert('单击点的坐标为:' + e.point.lng + ',' + e.point.lat); // 监听点击事件
 });
 map.addOverlay(pointCollection); // 添加Overlay
 } else {
 alert('请在chrome、safari、IE8+以上浏览器查看本示例');
 }海量点没有在地图上面显示出来。
相关文章:
百度地图JavaScript API如何在同一页面显示多个地图
百度地图API使用方法详解
相关视频:
百度地图开发文档
下载本文