HeatMap
The map supports heat map settings.
Load the heatmap after map initialization
//The heatmap layer needs to be executed after the map is loaded or triggered by clicking the button
//map.on('load',()=>{
// Please add the heatmap layer loading operation here
//})
//testJson is the data format for heat maps,{lng:longitude,lat:latitude,count:heatmap value}
window.testJson = [{"lng":116.191031,"lat":39.988585,"count":40},{"lng":116.389275,"lat":39.925818,"count":51},{"lng":116.287444,"lat":39.810742,"count":62},{"lng":116.481707,"lat":39.940089,"count":73},{"lng":116.410588,"lat":39.880172,"count":84}];
heatmap = new nimap.Heatmap(map, {
radius: 25, //The influence radius (in pixels) of a heat map point will gradually spread outward from the center point within 25 pixels of this point
opacity: 0.8, // opacity of layer
gradient: { // The color range of the layer
0.2: 'blue',
0.4: 'rgb(117,211,248)',
0.6: 'rgb(0, 255, 0)',
0.8: '#ffea00',
1.0: 'red'
}
});
heatmap.setDataSet({
data: window.testJson, // test data
max: 100 //Opposite to the gradient color above.
});
