import Vector from 'ol/source/Vector.js'
import { Heatmap as HeatmapLayer } from 'ol/layer.js'
import Feature from 'ol/Feature.js'
import Point from 'ol/geom/Point.js'
var webgissource={};
webgissource.heatmapsource=new Vector()
webgissource.heatmapvector = new HeatmapLayer({
// 矢量数据源
source: webgissource.heatmapsource,
blur: parseInt(50, 10), // 模糊尺寸
opacity: 1,
radius: parseInt(30, 10) // 热点半径
})
map.addLayer(webgissource.heatmapvector);
static heatmaplayer(data){
//data数据格式{x:107.4,y108.5} for循环执行heatmaplayer()
var points=new Point([data.x,data.y]);
var iconFeature = new Feature({
geometry:points,
attributions:{
feature:data,
type:'rlt'
}
})
webgissource.heatmapvector.getSource().addFeature(iconFeature)
}
转载:https://blog.csdn.net/weixin_38190600/article/details/102488135
查看评论