首页 / 浏览问题 / 云GIS / 问题详情
leaflet加载wmts服务,怎么获取子图层信息
22EXP 2019年08月29日


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_wmtsLayer"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";

    var res = [];
    for (var i = 0; i < 22; i++) {
        res.push(165664.43905455674 / (Math.pow(2, i)));
    }
    var map = L.map('map', {
        center: [0, 0],
        maxZoom: 18,
        zoom: 0,
        crs: new L.Proj.CRS("EPSG:3857",
            {
                origin: [-2.0037508342789244E7, 2.0037508342789244E7],
                resolutions: res,
                bounds: L.bounds([-2.0037508342789244E7, -2.0037508342789244E7], [2.0037508342789244E7, 2.0037508342789244E7])
            })
    });
    L.supermap.wmtsLayer(host + "/iserver/services/map-china400/wmts100",
        {
            layer: "China",
            style: "default",
            tilematrixSet: "Custom_China",
            format: "image/png",
            requestEncoding: 'REST',
            attribution: "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span>"
        }
    ).addTo(map);

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

怎么获取子图层信息

1个回答

目前这个功能没有直接接口,需要自行查找leaflet相关插件或通过OGC的服务接口自己通过代码实现,像基于OGC标准的WMTS的getCapabilities请求
5,668EXP 2019年08月29日
...