forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOGC_wmtsLayer.html
More file actions
62 lines (60 loc) · 2.51 KB
/
OGC_wmtsLayer.html
File metadata and controls
62 lines (60 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!--********************************************************************
* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; 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" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
var map, layer,
host = window.isLocal ? window.server : "https://iserver.supermap.io";
url = host + "/iserver/services/map-world/wmts100";
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
})]
});
//wmts或许所需要的matrixID信息
var matrixIds = [];
for (var i = 0; i < 22; ++i) {
matrixIds[i] = {identifier: i};
}
;
//当前图层的分辨率数组信息,和matrixIds一样,需要用户从wmts服务获取并明确设置,resolutions数组和matrixIds数组长度相同
var resolutions = [1.25764139776733, 0.628820698883665, 0.251528279553466,
0.125764139776733, 0.0628820698883665, 0.0251528279553466,
0.0125764139776733, 0.00628820698883665, 0.00251528279553466,
0.00125764139776733, 0.000628820698883665, 0.000251528279553466,
0.000125764139776733, 0.0000628820698883665, 0.0000251528279553466,
0.0000125764139776733, 0.00000628820698883665, 0.00000251528279553466,
0.00000125764139776733, 0.000000628820698883665, 0.000000251528279553466];
//新建图层
layer = new SuperMap.Layer.WMTS({
name: "World",
url: url,
layer: "World",
style: "default",
matrixSet: "GlobalCRS84Scale_World",
format: "image/png",
resolutions: resolutions,
matrixIds: matrixIds,
opacity: 1,
requestEncoding: "KVP"
});
//图层添加并显示指定级别
map.addLayers([layer]);
map.setCenter(new SuperMap.LonLat(0, 0), 2);
</script>
</body>
</html>