Class: HeatMapLayer
优质
小牛编辑
126浏览
2023-12-01
CMAP~ HeatMapLayer
地球热力图图层类
new HeatMapLayer(options)
构造函数
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | 参数列表 Properties
|
Example
$.ajax({ type: 'GET', url: 'https://www.thingjs.com/uearth/res/beijing-POIs-3211.geojson', dataType: 'json', success: function (data) { var heatmapLayer = app.create({ type: 'HeatMapLayer', dataSource: data, //数据源 geojson格式 valueField: 'code', //权重字段 needsUpdate: true, //是否随相机的变化重新绘制热力图 renderer: { radius: 10, // 影响半径 minOpacity: 0.2,//最小值的透明度 maxOpacity: 0.8,//最大值的透明度 mosaic: true,//是否使用马赛克效果 mosaicSize: 5,//马赛克效果的像素值 gradient: { 0: 'rgb(0,0,255)', 0.33: 'rgb(0,255,0)', 0.66: 'rgb(255,255,0)', 1.0: 'rgb(255,0,0)' } //色带 }, }); map.addLayer(heatmapLayer); } });
Members
dataSource :Object
生成热力图使用的数据源 支持geojson的点数据源
Type:
- Object
Example
heatMapLayer.dataSource = { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties": { "type": "rain", "value": 5 }, "geometry": { "type": "Point", "coordinates": [-73.99995803833008, 40.71805432623303] } }, { "type": "Feature", "properties": { "type": "water", "value": 7 }, "geometry": { "type": "Point", "coordinates": [-73.98167610168457, 40.726087955120704] } }] }
needsUpdate :Boolean
是否随相机变化刷新
Type:
- Boolean
valueField :String
热力图权重字段
Type:
- String