-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.html
175 lines (170 loc) · 4.72 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<style>
body,
html {
width: 100%;
height: 100%;
overflow: hidden;
}
#app {
overflow: hidden;
background: #fff;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#map {
width: 100%;
height: 100%;
}
</style>
<link href="https://cdn.bootcss.com/normalize/8.0.0/normalize.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/mapbox-gl/0.43.0/mapbox-gl.css" rel="stylesheet">
</head>
<body>
<div id="app">
<div id="map"></div>
</div>
<script src="https://cdn.bootcss.com/mapbox-gl/0.43.0/mapbox-gl.js" charset="utf-8"></script>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" charset="utf-8"></script>
<!-- 引入 echarts.js -->
<script src="https://cdn.bootcss.com/echarts/4.0.4/echarts.min.js"></script>
<script src="./echarts-gl.min.js" charset="utf-8"></script>
<script type="text/javascript">
// mapbox TOKEN
mapboxgl.accessToken = 'pk.eyJ1IjoiamFzb25obyIsImEiOiJjamU1Yjh6YTAyeXczMnFwOTl1aGRwNnZmIn0.cSgyLOqrlhlNPPpZAtXO7g'
var myChart = echarts.init(document.getElementById("map"))
$.getJSON("map.geojson", function(buildingsGeoJSON) {
// 注册可用的地图
echarts.registerMap('buildings', buildingsGeoJSON)
// 地图区域的数据
var regionsData = buildingsGeoJSON.features.map(function(feature) {
return {
name: feature.properties.name,
value: Math.random(),
height: Math.random() * 1000,
label: feature.properties.name
};
})
$.getJSON("road.geojson", function(roadsJSON) {
// console.log(roadsJSON)
var taxiRoutes = roadsJSON.map(item => {
let coor = item.toString().split(/[_|]/)
return {
lineStyle: {},
coords: coor.map(i => i.split(','))
}
})
console.log(taxiRoutes)
var echartsOption = {
visualMap: {
show: false,
min: 0.4,
max: 1,
inRange: {
color: ['rgb(138, 43, 83)']
}
},
mapbox: {
center: [113.524173, 22.801624],
style: 'mapbox://styles/jasonho/cje7u4sylbj7f2sn31bxq55t6',
zoom: 13,
pitch: 100,
bearing: -10,
dragRotate: false,
trackResize: true,
attributionControl: false,
postEffect: {
enable: true,
SSAO: {
enable: true,
intensity: 1.3,
radius: 5
},
screenSpaceReflection: {
enable: false
}
},
groundPlane: {
show: true,
color: '#333'
},
light: {
main: {
intensity: 6,
shadow: true,
shadowQuality: 'high',
alpha: 30
},
ambient: {
intensity: 0
},
ambientCubemap: {
texture: './ambientCubemapTexture.hdr',
exposure: 2,
diffuseIntensity: 1,
specularIntensity: 2
}
}
},
// 系列列表
series: [{
type: 'lines3D',
coordinateSystem: 'mapbox',
effect: {
show: true,
constantSpeed: 5,
trailWidth: 2,
trailLength: 0.4,
trailOpacity: 1,
spotIntensity: 10
},
blendMode: 'lighter',
polyline: true,
lineStyle: {
width: 0.1,
color: 'rgb(1, 166, 192)',
opacity: 0.
},
data: taxiRoutes
}, {
type: 'map3D',
map: 'buildings', // registerMap注册
data: regionsData,
shading: 'realistic',
instancing: true,
// ====
coordinateSystem: 'mapbox',
silent: true,
realisticMaterial: {
metalness: 1,
roughness: 0.2,
},
groundPlane: {
show: true,
color: '#333'
},
boxWidth: 200,
boxHeight: 1,
viewControl: {
minBeta: -360,
maxBeta: 360,
autoRotate: true
},
}]
}
// 使用刚指定的配置项和数据显示图表
myChart.setOption(echartsOption)
})
})
</script>
</body>
</html>