Home  >  Article  >  Web Front-end  >  javascript - The point where the person is on the map cannot be achieved using the API's massive points

javascript - The point where the person is on the map cannot be achieved using the API's massive points

php是最好的语言
php是最好的语言Original
2018-08-02 15:08:131208browse

Title description

##Demo of Baidu Map API using massive points. Unable to display massive points.

Source of the question and your own ideas

You need to depict the points where the people are located on the map. This is achieved using the massive points of Baidu Map API.

Related code

if (document.createElement('canvas').getContext) { // Determine whether the current browser supports drawing massive points

            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?

javascript - The point where the person is on the map cannot be achieved using the APIs massive points

A large number of points are not displayed on the map.

Related articles:

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:


Baidu Map Development Document

The above is the detailed content of javascript - The point where the person is on the map cannot be achieved using the API's massive points. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn