Title description
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+以上浏览器查看本示例'); }The results you expect What is it? What is the actual error message you see?
How to use Baidu Map JavaScript API to display multiple maps on the same page
Detailed explanation of how to use Baidu Map API
Related videos: