let map = new AMap.Map("maps", {   //maps是容器的id名      zoom: 4, //地图显示的缩放级别      layers: [        new AMap.TileLayer.Satellite({  //卫星模式          zIndex: 0        })      ],      mapStyle: "amap://styles/darkblue"      //showIndoorMap: false    });
new AMap.DistrictSearch({      extensions: "all",      subdistrict: 0    }).search("山西省", function(status, result) { //只需将山西省换成你要显示的省名就可以了      // 外多边形坐标数组和内多边形坐标数组      var outer = [        new AMap.LngLat(-360, 90, true),        new AMap.LngLat(-360, -90, true),        new AMap.LngLat(360, -90, true),        new AMap.LngLat(360, 90, true)      ];      var holes = result.districtList[0].boundaries;
      var pathArray = [outer];      pathArray.push.apply(pathArray, holes);      var polygon = new AMap.Polygon({        pathL: pathArray,        // strokeColor: '#f00',        strokeWeight: 1,        fillColor: "#051a49",        fillOpacity: 1      });      polygon.setPath(pathArray);      that.map.add(polygon);    });
评论