首页 > 其他分享 >首页地图添加热力图

首页地图添加热力图

时间:2023-03-06 18:23:03浏览次数:38  
标签:ol feature 力图 添加 heatMap 首页 new event

loadHeatMap(){
let that = this;
//创建一个Heatmap图层
that.heatMapSource = new ol.source.Vector({
url: "/static/public/map/heatMapLayer.json",//还可以是kml文件格式
format: new ol.format.GeoJSON();//对应上面文件地址格式
})
that.heatMap = new ol.layer.Heatmap({
source: that.heatMapSource,
radius: 10,//半径
blur: 20,//点位模糊值
  //visible:热热力图的显示隐藏 that.heatMap.setVisible(false/true)---通过按钮来控制来显示热力图

});
that.heatMap.getSource().on('addfeature', function (event) {//叠加热力图要素
var name = event.feature.get('name');//自定义属性
var magnitude = event.feature.get("probability");
event.feature.set('weight', magnitude - 0);//这两句是筛选发生率大于某一个值,低于某一个值得时候不显示点位,高于设定值才显示
});
that.heatMap.setZIndex(2001)
that.map.addLayer(that.heatMap);//给首页地图添加上热力图的图层
},

标签:ol,feature,力图,添加,heatMap,首页,new,event
From: https://www.cnblogs.com/kaoo-kiee/p/17184895.html

相关文章