-
Notifications
You must be signed in to change notification settings - Fork 0
/
map(北京公交线路).html
211 lines (199 loc) · 6.53 KB
/
map(北京公交线路).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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>OpenLayers-echarts案例:北京公交线路</title>
<script src="support/jquery-3.2.1.min.js" type="text/javascript"></script>
<link href="support/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script src="support/bootstrap/bootstrap.min.js" type="text/javascript"></script>
<script src="support/echarts.js" type="text/javascript"></script>
<link href="support/openlayers/ol.css" rel="stylesheet" type="text/css"/>
<script src="support/openlayers/ol.js" type="text/javascript"></script>
<script src="support/openlayers_echart.es5_1.js" type="text/javascript"></script>
<link href="lib/map.css" rel="stylesheet" type="text/css"/>
<script src="lib/Connector.js" type="text/javascript"></script>
<script src="lib/Tools.js" type="text/javascript"></script>
<script src="lib/ImageAffair.js" type="text/javascript"></script>
<script src="lib/MapControl.js" type="text/javascript"></script>
<script src="lib/requests.js" type="text/javascript"></script>
<script src="lib/search.js" type="text/javascript"></script>
<script type="text/javascript" >
var mapcontrol = null;
$(document).ready(function () {
$('form').on('submit', function (e) {
search();
return false;
});
initSearchState();
check_map_extent = true;
$(".radio_group_1").hide();
$("#google_image_on").show();
mapcontrol = new MapControl({
target: "mapcontrol",
width: '100%',
height: '100%',
center: [116.5, 40],
zoom: 8
});
ROOT_PATH = 'https://cdn.jsdelivr.net/gh/apache/incubator-echarts-website@asf-site/examples';
$.get(ROOT_PATH + '/data/asset/data/lines-bus.json', function(data) {
var hStep = 300 / (data.length - 1);
var busLines = [].concat.apply([], data.map(function (busLine, idx) {
var prevPt;
var points = [];
for (var i = 0; i < busLine.length; i += 2) {
var pt = [busLine[i], busLine[i + 1]];
if (i > 0) {
pt = [
prevPt[0] + pt[0],
prevPt[1] + pt[1]
];
}
prevPt = pt;
points.push(ol.proj.transform([pt[0] / 1e4, pt[1] / 1e4], "EPSG:4326", "EPSG:3857"));
}
return {
coords: points,
lineStyle: {
normal: {
color: echarts.color.modifyHSL('#5A94DF', Math.round(hStep * idx))
}
}
};
}));
option = {
series: [{
type: 'lines',
// coordinateSystem: 'bmap',
polyline: true,
data: busLines,
silent: true,
lineStyle: {
// color: '#c23531',
// color: 'rgb(200, 35, 45)',
opacity: 0.2,
width: 1.5
},
progressiveThreshold: 500,
progressive: 200
}, {
type: 'lines',
// coordinateSystem: 'bmap',
polyline: true,
data: busLines,
lineStyle: {
width: 1.5
},
effect: {
constantSpeed: 20,
show: true,
trailLength: 0.1,
symbolSize: 1.5
},
zlevel: 1
}]
};
var oe = new ADLayer(option, mapcontrol._Map, echarts);
oe._render();
});
var id = getQueryVariable("id");
if(id){
mapcontrol.GotoPoint(id);
}
ShowState();
});
</script>
<style>
nav {
width: 75%;
padding: 0 1em 0 1em;
margin: auto;
}
</style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">演示网站</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="index.html">地图</a>
</li>
<li>
<a href="database.html">数据库</a>
</li>
<li>
<a href="liveview.html">图片列表</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">地图设置<strong class="caret"></strong></a>
<ul class="dropdown-menu">
<li>
<a onclick="changeSource('google_image')">Google影像<span id="google_image_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('google_image_y')">Google影像(带标签)<span id="google_image_y_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('google_map')">Google地图<span id="google_map_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('google_topo')">Google地形图<span id="google_topo_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('osm')">OpenStreetMap<span id="osm_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('amap')">高德地图<span id="amap_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('sea_map')">全球海图<span id="sea_map_on" class="radio_group_1"> ✔</span></a>
</li>
<li>
<a onclick="changeSource('lucc')">全球土地利用<span id="lucc_on" class="radio_group_1"> ✔</span></a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input id="tag" type="text" class="form-control" />
<input id="date" type="date" class="form-control" />
</div>
<div class="btn-group">
<button class="btn btn-default">查询设置</button><button data-toggle="dropdown" class="btn btn-default dropdown-toggle"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li>
<a onclick="toggleMapExtent()">只在地图视窗范围内搜索<span id="map_extent_on" class="check"> ✔</span></a>
</li>
<li class="divider"></li>
<li>
<a onclick="reset()">重置查询条件</a>
</li>
<li>
<a onclick="ShowState()">显示当前查询条件</a>
</li>
</ul>
</div>
<button class="btn btn-default">查询</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="about.html">关于我们</a>
</li>
</ul>
</div>
</nav>
<div id="mapcontrol"></div>
<div id="popup"></div>
</body>
</html>