-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
157 lines (153 loc) · 4.24 KB
/
test.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!doctype html>
<html>
<head>
<title>OpenLayers 3 example</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="http://openlayers.org/en/latest/css/ol.css" />
<link rel="stylesheet" href="http://cdn.rawgit.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.css" />
</head>
<body>
<!-- http://www.cnblogs.com/kekec/p/3159970.html -->
<!-- http://www.cnblogs.com/jz1108/archive/2011/07/02/2095376.html -->
<div id="map" class="map"></div>
<script src="http://openlayers.org/en/latest/build/ol.js"></script>
<script src="http://cdn.rawgit.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.js"></script>
<script>
let map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Group({
title: 'Google',
layers: [
new ol.layer.Tile({
title: 'Google Map',
type: 'base',
source: new ol.source.XYZ({
url: 'http://mt{0-3}.google.cn/vt/x={x}&y={y}&z={z}',
})
}),
new ol.layer.Tile({
title: 'Google Map (Wrapper)',
type: 'base',
source: new ol.source.XYZ({
url: 'http://127.0.0.1:8080/google_shifted/{z}/{x}/{y}'
})
}),
new ol.layer.Tile({
title: 'Google Sat',
type: 'base',
source: new ol.source.XYZ({
url: 'http://mt{0-3}.google.cn/vt/lyrs=s&x={x}&y={y}&z={z}',
})
}),
]
}),
new ol.layer.Group({
title: 'Bing (Wrapper)',
layers: [
new ol.layer.Tile({
title: 'Bing',
type: 'base',
source: new ol.source.XYZ({
minZoom: 1,
url: 'http://127.0.0.1:8080/bing/{z}/{x}/{y}'
})
}),
new ol.layer.Tile({
title: 'Bing Shifted',
type: 'base',
source: new ol.source.XYZ({
minZoom: 1,
url: 'http://127.0.0.1:8080/bing_shifted/{z}/{x}/{y}'
})
}),
]
}),
new ol.layer.Group({
title: 'Baidu (Wrapper)',
layers: [
new ol.layer.Tile({
title: 'Baidu Map',
type: 'base',
source: new ol.source.XYZ({
minZoom: 2,
maxZoom: 19,
url: 'http://127.0.0.1:8080/baidu/{z}/{x}/{y}'
})
}),
new ol.layer.Tile({
title: 'Baidu Sat',
type: 'base',
source: new ol.source.XYZ({
minZoom: 2,
maxZoom: 19,
url: 'http://127.0.0.1:8080/baidu_sat/{z}/{x}/{y}'
})
}),
]
}),
new ol.layer.Group({
title: 'Tian',
layers: [
new ol.layer.Group({
title: 'Tian Map',
type: 'base',
combine: true,
layers: [
new ol.layer.Tile({
title: 'Tian',
source: new ol.source.XYZ({
maxZoom: 18,
url: 'http://t{0-7}.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}',
})
}),
new ol.layer.Tile({
title: 'Tian Loc',
source: new ol.source.XYZ({
maxZoom: 18,
url: 'http://t{0-7}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}',
})
}),
]
}),
new ol.layer.Group({
title: 'Tian Sat',
type: 'base',
combine: true,
layers: [
new ol.layer.Tile({
title: 'Tian Sat',
maxZoom: 19,
source: new ol.source.XYZ({
url: 'http://t{0-7}.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}',
})
}),
new ol.layer.Tile({
title: 'Tian Sat Loc',
maxZoom: 19,
source: new ol.source.XYZ({
url: 'http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}',
})
}),
]
}),
]
}),
new ol.layer.Tile({
title: 'OSM',
type: 'base',
source: new ol.source.OSM
}),
],
controls: [
new ol.control.LayerSwitcher,
new ol.control.Zoom,
],
view: new ol.View({
center: ol.proj.fromLonLat([121, 31]),
zoom: 14
})
})
</script>
</body>
</html>