<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>MapVGL</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#map_container {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="//api.map.baidu.com/api?v=1.0&type=webgl&ak=1XjLLEhZhQNUzd93EjU5nOGQ"></script>
<script src="//mapv.baidu.com/build/mapv.min.js"></script>
<script src="static/common.js"></script>
<script src="https://code.bdstatic.com/npm/mapvgl@1.0.0-beta.93/dist/mapvgl.min.js"></script>
</head>
<body>
<div id="map_container"></div>
<script>
/* global BMapGL */
/* global mapv */
/* global mapvgl */
/* global initMap */
/* global whiteStyle */
/* global purpleStyle */
var map = initMap({
tilt: 0,
heading: 0,
center: [105.348145,37.976416],
zoom: 5,
style: purpleStyle
});
// 创建九段线
var pt = new BMapGL.Point(130.943495,22.781036);
var myIcon = new BMapGL.Icon('images/jiuduanxian.png', new BMapGL.Size(102, 150));
var marker = new BMapGL.Marker(pt, {icon: myIcon, enableDragging: true}); // 创建标注
map.addOverlay(marker);
var view = new mapvgl.View({
map: map
});
fetch('./data/chinalocation.json').then(rs => {
return rs.json();
}).then(rs => {
var data1 = [];
var data2 = [];
var data3 = [];
for (var i = 0; i < rs[0].length; i++) {
var geoCoord = rs[0][i].geoCoord;
data1.push({
geometry: {
type: 'Point',
coordinates: geoCoord
},
properties: {
time: Math.random() * 100
}
});
}
for (var i = 0; i < rs[1].length; i++) {
var geoCoord = rs[1][i].geoCoord;
data2.push({
geometry: {
type: 'Point',
coordinates: geoCoord
},
properties: {
time: Math.random() * 10
}
});
}
for (var i = 0; i < rs[2].length; i++) {
var geoCoord = rs[2][i].geoCoord;
data3.push({
geometry: {
type: 'Point',
coordinates: geoCoord
},
properties: {
time: Math.random() * 10
}
});
}
view.addLayer(new mapvgl.PointLayer({
blend: 'lighter',
shape: 'circle',
color: 'rgba(255, 77, 77, 0.8)', // 点图层1颜色
data: data1,
size: 1
}));
view.addLayer(new mapvgl.PointLayer({
blend: 'lighter',
shape: 'circle',
color: 'rgba(255, 204, 0, 0.6)', // 点图层2颜色
data: data2,
size: 1.5
}));
view.addLayer(new mapvgl.PointLayer({
blend: 'lighter',
shape: 'circle',
color: 'rgba(255, 255, 0, 0.6)', // 点图层3颜色
data: data3,
size: 2
}));
view.addLayer(new mapvgl.PointTripLayer({
blend: 'lighter',
shape: 'circle',
startTime: 0,
endTime: 100,
step: 0.1,
trailLength: 10,
color: 'rgba(255, 255, 153, 0.5)', // 点动画图层颜色
data: data1,
size: 1.5
}));
});
</script>
</body>
</html>
0
0
投票数
文章评分