<!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>
备注:分辨率通过发布的底图的比例尺换算得出。

7797

被折叠的 条评论
为什么被折叠?



