统计样式
index.html
<!DOCTYPE html>
<html>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>图形样式 - 统计样式</title>
  <link rel="icon" href="/examples/static/resource/image/favicon.png" />
  <style type="text/css">
    html,body{margin:0px;height:100%;width:100%}
    .container{width:100%;height:100%}
  </style>
  <link rel="stylesheet" href="//rd.sz-map.com/libs/gm/gl/gl.min.css">
  <script type="text/javascript" src="//rd.sz-map.com/libs/gm/gl/gl.min.js"></script>
  <body>
    
    <div id="map" class="container"></div>

    <script>
      function initMap() {
        this.map = new GL.Map('map', {
          center: '120.650847,31.3092434',
          zoomControl: false,
          scaleControl: false
        });
      
        var crs = {"resolutions":[0.0009765664903423653,0.0004882832451711827,0.00024414162258559134,0.00012207081129279567,0.00006103540564766688,0.000030517702822564394,0.000015258851412551242,0.000007629425705006574,0.000003814712853772333,0.00000190735154359766],"origin":"119.75,32.25"};
        var options = {"maxBounds":"119.89,30.75;121.406,32.08","preview":"/examples/static/images/preview.png"};
      
        var baseLayer = GL.LayerLookup.createGaeaTiledLayer(
          'http://119.3.130.139/tiles/vector_pc/_alllayers',
          Object.assign({}, options, {zIndex: 3}),
          crs
        );
        this.map.addBaseLayer(baseLayer);
      
        addOverlay();
      }
      
      function addOverlay() {
        var vectorLayer = new GL.VectorLayer('vectorLayer');
        this.map.addLayer(vectorLayer);
      
        this.point2 = new GL.Point(
          [120.5087985, 31.2475109],
          new GL.Icon.Stat(
            '<p style="font-size: 14px;">这是一个自定义内容</p>',
            function () {
              var d = GL.DomUtil.create('div');
              d.innerHTML =
                '<a style="color: red;" href="javascript:void(0);" onclick="alert(\'function 自定义内容\')">点我</a>';
              return d;
            },
            '2',
            '',
            { descClassName: 'customize' }
          )
        );
        vectorLayer.addOverlay(this.point2);
      
        var data3 = [
          {
            icon: '/examples/static/icons/0001.png',
            text: '出租车',
            count: 5000
          },
          {
            icon: '/examples/static/icons/0002.png',
            text: '公交车',
            count: 420
          },
          {
            icon: '/examples/static/icons/0003.png',
            text: '警车',
            count: 2000
          },
          {
            icon: '/examples/static/icons/0011.png',
            text: '摩托车',
            count: 420
          },
          {
            icon: '/examples/static/icons/0005.png',
            text: '电动车',
            count: 555
          }
        ];
        this.point3 = new GL.Point(
          [120.6519469, 31.3393882],
          new GL.Icon.Stat(478631, data3, '2')
        );
        vectorLayer.addOverlay(this.point3);
      
        var data4 = [
          {
            icon: '/examples/static/icons/0001.png',
            text: '出租车',
            count: 5000
          },
          {
            icon: '/examples/static/icons/0002.png',
            text: '公交车',
            count: 420
          },
          {
            icon: '/examples/static/icons/0003.png',
      
            text: '警车',
            count: 2000
          },
          {
            icon: '/examples/static/icons/0015.png',
            text: '摩托车',
            count: 420
          },
          {
            icon: '/examples/static/icons/0014.png',
            text: '电动车',
            count: 555
          }
        ];
        this.point4 = new GL.Point(
          [120.7471253, 31.3061408],
          new GL.Icon.Stat(243245, data4, '1', [100, 100])
        );
        vectorLayer.addOverlay(this.point4);
      }
      
      GL.init(initMap, '/examples/static/conf.json');

    </script>
  </body>
</html>
已复制!