如何为openlayers中的每个点自定义渐变颜色?

时间:2018-07-20 17:35:45

标签: openlayers

我正在使用openlayers 5构建热图。我想根据测试条件自定义每个点的渐变颜色,但是看起来渐变是固定的,用于点的“源”向量。

如何为“ pointFeature”自定义渐变?

下面您可以看到我的JavaScript代码的一部分:

var data = new ol.source.Vector();
var coord = ol.proj.fromLonLat([long,lat]);
var lonLat = new ol.geom.Point(coord);
var pointFeature = new ol.Feature({
    geometry: lonLat,
    weight: 20 
});
data.addFeature(pointFeature);

heat_map_layer = new ol.layer.Heatmap({
  source: data,
  radius: 10,
  gradient: ['#f00', '#f00', '#f00', '#f00', '#f00']
});

0 个答案:

没有答案