美文网首页
Supermap Leaflet 地图加载

Supermap Leaflet 地图加载

作者: 清白的少年 | 来源:发表于2020-07-27 10:53 被阅读0次
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body style=" margin: 0;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
        
        <div id="map" style="margin:0 auto;width: 100%; height: 100%; z-index: 0; position: absolute"></div>
        
    
        <script src="dist/include-leaflet.js"></script>
        <script src="js/include-web.js"></script>
        
        <script>
            
            '''  地图服务 '''
            var data_maps = L.supermap.tiledMapLayer(
                "http://localhost:8090/iserver/services/map-xx/rest/maps/map", {
                noWrap: true,
                transparent: true
            });
            '''  需要自己申请天地图TOKEN并替换xxx'''
            var tiandi_layer = L.supermap.tiandituTileLayer({
                url: "http://t0.tianditu.gov.cn/img_c/wmts?tk=xxx",
                layerType: "img"
            });
            '''  需要自己申请天地图TOKEN并替换xxx'''
            var tiandi_zj = L.supermap.tiandituTileLayer({
                url: "http://t0.tianditu.gov.cn/cia_c/wmts?tk=xxx",
                layerType: "cia"
            });
            
            var map = L.map('map', {
                center: [x, y], 
                maxZoom: 17,
                zoom: 15,
                crs: L.CRS.EPSG4326,
                layers: [tiandi_layer, tiandi_zj, data_maps]
            });
            
            var baseMaps = {
                "天地图": tiandi_layer
            }
            var overlayMaps = {
                "天地图图注记": tiandi_zj,
                "项目数据": data_maps
            };
            
            L.control.layers(baseMaps, overlayMaps).addTo(map); 
                
        </script>
        
    </body>
</html>

相关文章

网友评论

      本文标题:Supermap Leaflet 地图加载

      本文链接:https://www.haomeiwen.com/subject/lutzlktx.html