1. HeatMap

热力图

1.1. 初始化 new HeatMap(viewer, data, [opts])

Param Type Default Description
viewer Viewer

GeoMap对象的viewer属性

data Object

数据

[opts] Object

设置

[opts.backgroundColor] String "rgba(255,0,0,0)"

背景色

[opts.radius] Number 50

缓冲半径

[opts.opacity] Number 0

不透明度

[opts.maxOpacity] Number .93

最大不透明度

[opts.minOpacity] Number 0

最小不透明度

[opts.blur] Number 0.75

模糊因素将被应用到所有的数据点。模糊因子越高,平滑渐变

[opts.xField] Number 'x'

数据点的x坐标

[opts.yField] Number 'y'

数据点的y坐标

[opts.valueField] Number 'value'

数据点的值的字段名

[opts.gradient] Object {'.3': 'blue','.65': 'yellow','.8': 'orange','.95': 'red'}

颜色梯度条带,格式为{value : colorString,.... },value为[0,1]范围内逐渐增加的数值字符串,colorString为颜色字符串,可为十六位颜色字符串。

[opts.startColor] String

十六位起始颜色,与options.endColor一起设置,设置后options.gradient不起效。

[opts.endColor] String

十六位结束颜色,与options.startColor 一起设置,设置后options.gradient不起效。

[opts.steps] Number 20

颜色条带分解次数,设置options.endColor和options.startColor时起效。

[opts.useEntitiesIfAvailable] Boolean true

是否使用实体entities如果Viewer支持时或总是使用一个ImageryProvider提供,默认为true,即使用,false则为不使用。

[opts.classificationType] String BOSGeo.ClassificationType.BOTH

贴合类型,包括BOSGeo.ClassificationType.TERRAIN (只贴地形)、BOSGeo.ClassificationType.CESIUM_3D_TILE (只贴模型)和BOSGeo.ClassificationType.BOTH(两者都起作用),默认是BOSGeo.ClassificationType.BOTH ,需opts.useEntitiesIfAvailable=true 时才起效。

[opts.zoomTo] Boolean true

是否缩放至图层范围,默认为true

[opts.spacingFactor] Number 1.5

额外的边界空间 (点半径乘以这个数字的收益率间距),默认为1.5。

[opts.radiusFactor] Number 60

使用数据点大小因素如果没有给定半径opts.radius(更大的高度和宽度除以这个数得到的值作为半径),默认为60。

[opts.minCanvasSize] Number 700

最小大小(以像素为单位)的热图画布。

[opts.maxCanvasSize] Number 2000

最大大小(以像素为单位)的热图画布。

Example

const data = [
    {
        "x": 147.1383442264,
        "y": -41.4360048372,
        "value": 76
    },
    {
        "x": 147.1384363011,
        "y": -41.4360298848,
        "value": 63
    }]
var gradientColors = new BOSGeo.Util.createGradientColors('#008000', '#ff0000', 10, 1);
var gradColors = {} //颜色条带
gradientColors.map((gc, i) => {
    let idx = (i / 10.0).toString()
    gradColors[idx] = gc
})
let opt = {
    valueField: "value",//数据值字段名,
    radius: 100,  //缓冲半径
    // gradient : gradColors,
    startColor: '#0000ff', //十六位起始颜色,与options.endColor一起设置,设置后options.gradient不起效,将替换options.gradient的设置结果this.opts.gradient中。
    endColor: '#ff0000',
    steps: 20, //颜色条带分解 次数,设置options.endColor和options.startColor时起效。
    classificationType: BOSGeo.ClassificationType.BOTH,
    useEntitiesIfAvailable: true
}
var heatMap = new BOSGeo.HeatMap(geomap.viewer, data, opt);

1.2. 属性

属性名 Type Description
show Boolean

是否显示图层

classificationType String

贴合类型,类型BOSGeo.ClassificationType.TERRAIN(地形)、BOSGeo.ClassificationType.CESIUM_3D_TILE(模型)和BOSGeo.ClassificationType.BOTH(两者),默认是BOSGeo.ClassificationType.BOTH,需opts.useEntitiesIfAvailable=true 时才起效。

1.3. 方法

1.3.1. heatMap.setData(data)

更新数据源

Param Type Description
data Object

数据

Example

var heatMap = new BOSGeo.HeatMap(geomap.viewer, data);
heatMap.setData(data)

1.3.2. heatMap.zoomTo()

缩放至本图层

1.3.3. heatMap.remove()

移除

1.3.4. heatMap.destroy()

销毁

版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-05-18 18:07:58

results matching ""

    No results matching ""