首页 / 浏览问题 / 云GIS / 问题详情
leaflet客户端加载发布的地图不显示
5EXP 2019年05月13日
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title data-i18n="resources.title_pulse"></title>
    <link href="../lib/leaflet/leaflet.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../lib/leaflet/leaflet-src.js"></script>
    <!-- <script src="../lib/leaflet/leaflet.ChineseTmsProviders.js"></script> -->
    
    <script type="text/javascript" src="../lib/supermap/js/include-web.js"></script>
    <script type="text/javascript" src="../lib/supermap/dist/leaflet/include-leaflet.js"></script>
    <script type="text/javascript" src="../lib/leaflet/proj4-src.js"></script>
    <script type="text/javascript" src="../lib/leaflet/proj4leaflet.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 id = "info"></div>
    </div>
    <!-- <script type="text/javascript" src="../js/init_map.js"></script> -->
    <script type="text/javascript">
        var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
        var map, resultLayer, markers = [],
            url = host + "/iserver/services/map-ya_map/rest/maps/qiaobeiju";
        // 定义地图投影
        let centerPoint = new L.LatLng(36.06, 117.94); // 设置地图中心
        const CRS2384 = new L.Proj.CRS(
            "EPSG:2384",
            "+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +a=6378140 +b=6356755.288157528 +units=m +no_defs",
            {
                resolutions: function () {
                    level = 19;
                    var res = [];
                    res[0] = Math.pow(2, 18);
                    for (var i = 1; i < level; i++) {
                        res[i] = Math.pow(2, (18 - i))
                    }
                    return res;
                }(),
                origin: [3992456.6, 584523.08],
                bounds: L.bounds([544366.17 , 3956156.71], [624679.98 , 4028756.49])
            });
        
        map = L.map('map', {
            crs: CRS2384,
            preferCanvas: true,
            center: centerPoint, 
            logoControl: false,
            attributionControl: false
        });
        console.log("url: ", url);
        L.supermap.tiledMapLayer(url).addTo(map);
        L.control.scale().addTo(map)
    </script>
</body>

</html>

加载自己发布的投影坐标系地图不显示,1980 guass 39n 

1个回答

您好,您这个服务在iserver预览能看到吗?如果可以的话就检查一下代码,应该是代码编写问题
于浩
1
5,668EXP 2019年05月13日
...