-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
115 lines (104 loc) · 3.05 KB
/
index.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html style="width: 100%; height: 100%;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>map-split</title>
<link href='https://unpkg.com/[email protected]/dist/mapbox-gl.css' rel='stylesheet' />
<style>
* {
margin: 0;
padding: 0;
}
#container {
width: 100%;
height: 100%;
}
</style>
</head>
<body style="width: 100%; height: 100%;">
<div id="container">
<div id="container1"></div>
<div id="container2"></div>
</div>
<script src="https://unpkg.com/mapbox-gl-split"></script>
<script src='https://unpkg.com/[email protected]/dist/mapbox-gl.js'></script>
</body>
<script>
const style1 = {
name: '司南智图',
zoom: 4,
center: [116.42, 40.33],
transition: {
duration: 300,
delay: 0
},
layers: [
{
id: '天地图矢量',
type: 'raster',
source: 'tdt_vec'
},
{
id: '天地图矢量注记',
type: 'raster',
source: 'tdt_cva'
}
],
metadata: {},
version: 8,
sources: {
tdt_vec: {
type: 'raster',
tiles: ['https://t5.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=b8b36f528ccc550525c7cada64303bc4'],
tileSize: 256
},
tdt_cva: {
type: 'raster',
tiles: ['https://t5.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=b8b36f528ccc550525c7cada64303bc4'],
tileSize: 256
}
}
};
const style2 = {
name: '司南智图',
zoom: 4,
center: [116.42, 40.33],
transition: {
duration: 300,
delay: 0
},
layers: [
{
id: '天地图影像',
type: 'raster',
source: 'tdt_img'
},
{
id: '天地图影像注记',
type: 'raster',
source: 'tdt_cia'
}
],
metadata: {},
version: 8,
sources: {
tdt_img: {
type: 'raster',
tiles: ['https://t5.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=b8b36f528ccc550525c7cada64303bc4'],
tileSize: 256
},
tdt_cia: {
type: 'raster',
tiles: ['https://t5.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=b8b36f528ccc550525c7cada64303bc4'],
tileSize: 256
}
}
};
const map1 = new mapboxgl.Map({ container: 'container1', style: style1, trackResize: true });
const map2 = new mapboxgl.Map({ container: 'container2', style: style2, trackResize: true });
new mapboxglSplit.SplitMap('container', {
maps: [map1, map2]
});
</script>
</html>