SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>to lww</title>
	<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
  <style>
    .amap-traffic {
      z-index: 111 !important;
    }
  </style>
</head>
<body>
<div id="container" class="container"></div>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=e692ff8624e7d5bb0beae36732ed2721"></script>
<script src="http://a.amap.com/Loca/static/mock/heatmapData.js"></script>
<script>

    var map = new AMap.Map('container', {
        mapStyle:"amap://styles/954b7e7e69b9361b21881ea934792e31",
        resizeEnable: true,
        center: [106.71, 26.57],
        viewMode: '2D',
        pitch: 50,
        zoom: 6
    });
    map.on('mapload', function() {
        map.getMap().plugin(['AMap.ControlBar'], function () {
            var controlBar = new AMap.ControlBar();
            map.getMap().addControl(controlBar);
        });
    });
   //获取边界坐标点
   AMap.plugin('AMap.DistrictSearch', () => {
        var districtSearch = new AMap.DistrictSearch({
        // 关键字对应的行政区级别,共有5种级别
        level: 'province',
        //  是否显示下级行政区级数,1表示返回下一级行政区
        subdistrict: 0,
       // 返回行政区边界坐标点
        extensions: 'all',
      })

        // 搜索所有省/直辖市信息
        districtSearch.search('辽宁', (status, result) => {
          // 查询成功时,result即为对应的行政区信息
          handlePolygon(result)
        })
        
        handlePolygon= (result)=>{
          let bounds = result.districtList[0].boundaries
          if (bounds) {
            for (let i = 0, l = bounds.length; i < l; i++) {
            //生成行政区划polygon
            let polygon = new AMap.Polygon({
              map: this.map,    // 指定地图对象
              strokeWeight: 1,    // 轮廓线宽度
              path: bounds[i],     //轮廓线的节点坐标数组
              fillOpacity: 0.15,     //透明度
              fillColor: '#256edc',     //填充颜色
              strokeColor: '#256edc',    //线条颜色
            })
            polygon.on('click', (e) => {
            // 点击绘制的区域时执行其他交互

            })
          }
      }
    }



    })
    var trafficLayer = new AMap.TileLayer.Traffic({
        zIndex: 15
    });

    trafficLayer.setMap(map);


</script>
</body>
</html>