高德地图制作省级地图
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);});
通过以上就可以实现一个省级地图,可以通过 new AMap.TileLayer.Satellite({})来控制是否是卫星地图模式,

浙公网安备 33010602011771号