小言_互联网的博客

openlayers 5.0 热力图

381人阅读  评论(0)
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
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场