-
Notifications
You must be signed in to change notification settings - Fork 0
/
扩散点.html
122 lines (121 loc) · 4.53 KB
/
扩散点.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>扩散点</title>
<meta charset="utf-8" />
<style type="text/css">
html, body {
margin: 0px;
height: 100%;
width: 100%;
}
#map {
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="css/mapbox-gl.css" type="text/css"/>
<script type="text/javascript" src="js/mapbox-gl.js"></script>
<script src="js/jquery.js"></script>
<script src="js/EchartsLayer/echarts.js"></script>
<script src="js/EchartsLayer/EchartsLayer.js"></script>
</head>
<body>
<div id="map"></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiZGRvbmciLCJhIjoiY2phNTk5OHR4M2xhMzJxbnJkdGN3ZTV0eCJ9.R5St4SUyuLiE6l-0dL4MOg';
var map = new mapboxgl.Map({
container: 'map', // container id
style: { // stylesheet location
"version": 8,
"sources": {},
"layers": []
},
center: [112.939,31.377], // starting position [lng, lat]
zoom: 4 // starting zoom
});
var arcgis_wmts ='http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/WMTS?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ChinaOnlineCommunity&STYLE=default&TILEMATRIXSET=default028mm&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image/png'
var arcgis_layer = {
"id": "arcgis_wmts",
"type": "raster",
"source": {
"type": "raster",
"tiles": [arcgis_wmts],
"zoomOffset": 0,//wmts Capabilities信息中TileMatrix第一个对应的实际多少级
"tileSize": 256
}
};
map.on("load",function(){
// * 加载底图
map.addLayer(arcgis_layer);
// 加载数据
$.getJSON('data/point.json', function (data) {
var option = {
title: {},
tooltip: {
trigger: 'item'
},
GLMap: {},
series: [{
name: 'pm2.5',
type: 'scatter',
coordinateSystem: 'GLMap',
data: data,
symbolSize: function (val) {
return val[2] / 10;
},
label: {
normal: {
formatter: '{b}',
position: 'right',
show: false
},
emphasis: {
show: true
}
},
itemStyle: {
normal: {
color: '#ddb926'
}
}
}, {
name: 'Top 5',
type: 'effectScatter',
coordinateSystem: 'GLMap',
data: data.sort(function (a, b) {
return b.value[2] - a.value[2];
}).slice(0, 5),
symbolSize: function (val) {
return val[2] / 10;
},
showEffectOn: 'render',
rippleEffect: {
brushType: 'stroke'
},
hoverAnimation: true,
label: {
normal: {
formatter: '{b}',
position: 'right',
show: true
}
},
itemStyle: {
normal: {
color: '#f4e925',
shadowBlur: 10,
shadowColor: '#333'
}
},
zlevel: 1
}]
};
var echartslayer = new EchartsLayer(map);
echartslayer.chart.setOption(option);
})
})
</script>
</body>
</html>