效果图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7ea0ee8f56a6a3c4189abec3081c010f.png)
1.首先引入CesiumHeatmap.js,CesiumHeatmap.js,地址不要积分。
2.地图初始化
var viewer = new Cesium.Viewer("csiumContain", {
homeButton: true,
animation: false,
timeline: false,
fullscreenButton: false,
baseLayerPicker: false,
sceneModePicker: true,
navigationHelpButton: false,
geocoder: false,
sceneModePicker: false,
});
3.初始化热力图范围
var bounds = {
west: 102.2666, south: 29.8166, east: 102.8866, north: 30.35
};
4.初始化CesiumHeatmap
var heatMap = CesiumHeatmap.create(
viewer,
bounds,
{
backgroundColor: "rgba(0,0,0,0)",
radius: 100,
maxOpacity: .5,
minOpacity: 0,
blur: .75,
}
)
5.添加数据
heatMap.setWGS84Data(-15, 20, getDataOpen(300));
function getDataOpen(length) {
var data = [];
data.push({ x: 102.8852, y: 30.0270, value: 15 });
data.push({ x: 102.5996, y: 30.0469, value: 16 });
data.push({ x: 102.772977, y: 30.061565, value: 13 });
return data;
}