1.public下index.html
<script src = 'https://webapi.amap.com/maps?v=2.0&key=你的秘钥' type="text/javascript" > </script>
<script src="https://webapi.amap.com/loader.js"></script>
2.页面中
// 设置安全密钥
window._AMapSecurityConfig = {
securityJsCode: '安全密钥',
}
3.加载地图图层
var map = new AMap.Map('你的地图id名', {
zoom: 12,
center: [中心点的经纬度]
});
var wms = new AMap.TileLayer.WMS({
url: 'wms图层地址',
blend: false,
tileSize: 256,
params: {
LAYERS: '你的LAYERS',
version: '1.3.0',
TRANSPARENT: 'TRUE',
ak:'你的ak',
FORMAT: 'image/png'
}
});
wms.setMap(map);