当前位置:网站首页>openlayers 5.0 热力图

openlayers 5.0 热力图

2022-04-23 19:08:00 Gis烤羊腿真好吃

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)
  }

版权声明
本文为[Gis烤羊腿真好吃]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_38190600/article/details/102488135