supermap for openlaeyrs 加载iserver发布的4490的切片服务



<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>加载地图服务</title>
    <script type="text/javascript" src="../js/include-web.js"></script>
    <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
</head>

<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
    <div id="map" style="width: 100%;height:100%;position: absolute;"></div>
    <script type="text/javascript">


        var proj = new ol.proj.Projection({
            code: "EPSG:4490",
            extent: [73.45, 18.16, 134.98, 53.53],
            units: "degrees",
        });

        const center = [112.85, 35.50];


        let originResult = { bounds: { "top": 42.614768999560994, "left": 110.22954600016925, "bottom": 31.38445900038204, "leftBottom": { "x": 110.22954600016925, "y": 31.38445900038204 }, "right": 119.84668699934679, "rightTop": { "x": 119.84668699934679, "y": 42.614768999560994 } } }
        var tileGrid = new ol.tilegrid.TileGrid({
            extent: [originResult.bounds.left, originResult.bounds.bottom, originResult.bounds.right, originResult.bounds.top],
            resolutions: [
                    0.0232529527610488,
                    0.0116264763805244,
                    0.0058132381902622,
                    0.0029066190951311,
                    0.0014533095475656,
                    0.0007266547612064,
                    0.0003633273931796,
                    0.0001816636840134,
                    0.0000908318420067,
                    0.0000454159210033,
                    0.0000227079730781,
                    0.000011353986539,
                    0.0000056769932695,
                ]
        });

        //构造切片图层
        const tileLayer = new ol.layer.Tile({
            source: new ol.source.TileSuperMapRest({
                url: "http://10.1.8.37:8089/iserver/services/map-ugcv5-TestShiBaiDi_4490/rest/maps/testlayer",
                tileGrid: tileGrid,
                crossOrign: 'anonymous'
            }),
        });

        const gwLayer = new ol.layer.Tile({
            source: new ol.source.TileSuperMapRest({
                url: "http://10.1.8.37:8089/iserver/services/map-TestGuanWang/rest/maps/testlayer",
                tileGrid: tileGrid,
            }),
        });

        //构造地图对象
        var map = new ol.Map({
            target: 'map',
            layers: [tileLayer,gwLayer],
            view: new ol.View({
                center: center,
                zoom:7,
               projection: proj,

            })
        });
    </script>
</body>

</html>

备注:分辨率通过发布的底图的比例尺换算得出。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值