zoukankan      html  css  js  c++  java
  • 百度地图加载海量点

    //初始化坐标点
    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 = {
           250, // 信息窗口宽度
          height: 70, // 信息窗口高度
          //title:"", // 信息窗口标题
          //enableMessage: false,// 设置允许信息窗发送短息
        }
        var infoWindow = new BMap.InfoWindow(content); // 创建信息窗口对象
        map.openInfoWindow(infoWindow,point); //开启信息窗口
      });
      // 添加Overlay
      map.addOverlay(pointCollection);
    }

     
  • 相关阅读:
    ApkAnalyser 一键提取安卓应用中可能存在的敏感信息(URLhash等)
    PostgreSQL创建只读权限的用户
    记一次 Centos7 Postgresql v11 数据库备份、还原
    Linux下安装pgadmin,并外部访问
    CentOS7中安装PostgreSQL客户端
    java.io.FileNotFoundException: Too many open files
    centos批量删除文件
    Centos7下Redis缓存清理_FZlion
    解决启动Apache遇到的问题Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8888
    CentOS 卸载软件
  • 原文地址:https://www.cnblogs.com/LinTianwen/p/12504113.html
Copyright © 2011-2022 走看看