高德地图加载WMS服务

页面展示

高德地图加载WMS服务

代码如下

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>高德加载WMS</title>
    <style>
        html,
        body,
        #container {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
<div id="container"></div>
<script src="//webapi.amap.com/maps?v=1.4.12&key=1a37a5cfea9cc8e1dd23cdb521ef1510"></script>
<script>
    var map = new AMap.Map('container', {
        resizeEnable: true,
        zoom: 11,
        center: [113.52448,34.71817]
    });

    var wms = new AMap.TileLayer.WMS({
        url: 'http://127.0.0.1:2010/geoserver/grid_map/wms',
        blend: true,
        tileSize: 256,
        params: {
            Layer: '0',
            Version: '1.0.0',
            Format: 'image/png',
            TileMatrixSet: 'EPSG:3857'
        }
    });

    wms.setMap(map);
</script>
</body>
</html>