Class: HeatMap

ol.source.HeatMap

HeatMapLayer class.

new ol.source.HeatMap(name, options)

HeatMap.js, line 13
Name Type Description
name string

The layer name.

options Object

Construction parameters.

Name Type Default Description
map ol.Map

The map object for OpenLayers.

id string optional

Theme layer ID. The theme layer ID is created by default using CommonUtil.createUniqueID("HeatMapSource_").

featureWeight string optional

Corresponds to the hotspot weight field name in the feature attribute, and the weight value type is float.

radius number 50 optional

The maximum radius of the hotspot rendering (hotspot pixel radius) in px. When the useGeoUnit parameter is true, the unit uses the current layer geographic coordinate unit. When the hotspot is displayed, the radiation attenuation is started to the periphery with the precise point as the center point, and the attenuation radius and the weight value are in a ratio.

loadWhileAnimating boolean true optional

Whether to draw in real time while moving.

opacity number 1 optional

The opacity.

colors Array.<string> ['blue','cyan','lime','yellow','red'] optional

Color linear gradient array, the color value must be supported by canvas.

useGeoUnit boolean false optional

Use the geographic unit, which is the default pixel radius by default. When set to true, the hotspot radius and the layer's geographic coordinates are consistent.

Extends

  • ol.source.ImageCanvas

Methods

addFeatures(features)

HeatMap.js, line 96

Add heat point information.

Name Type Description
features GeoJSONObject | Array.<ol.Feature> | ol.Feature

Feature array to add,support GeoJOSN object and ol.Feature object.

Example
var geojson = {
     "type": "FeatureCollection",
     "features": [
         {
             "type": "feature",
             "geometry": {
                 "type": "Point",  //Only support point type
                 "coordinates": [0, 0]
             },
             "properties": {
                 "height": Math.random()*9,
             }
         }
     ]
  };
var heatMapSource = new ol.source.HeatMap("heatMap",{"map": map});
heatMapSource.addFeatures(geojson);
map.addLayer(new ol.layer.Image({
      source: heatMapSource
  }));

getLocalXY(coordinate)

HeatMap.js, line 311

Get the coordinate system.

Name Type Description
coordinate Object

Coordinate position.

removeFeatures(features)

HeatMap.js, line 366

Remove the specified heat point information.

Name Type Description
features Array.<SuperMap.Feature.Vector>

An array of heat point information.

rotate(pixelP, rotation, center)

HeatMap.js, line 339

Get the pixel coordinates after a pixel coordinate point pixelP revolves the rotation arc in the center of the center counterclockwise.

Name Type Description
pixelP number

Pixel coordinates point position.

rotation number

Angle of rotation.

center number

Center position.

scale(pixelP, center, scaleRatio){Array.<number>}

HeatMap.js, line 352

Get the pixel coordinates of a pixel coordinate point pixelP is scaleRatio times larger than the center.

Name Type Description
pixelP Object

Pixel point.

center Object

Center position.

scaleRatio number

Scaling multiplier.

Returns:
Type Description
Array.<number> Return array ratio.

setOpacity(opacity)

HeatMap.js, line 128

Set the opacity of the layer, between values [0-1].

Name Type Description
opacity number

opacity.

toiClientFeature(features){SuperMap.Feature.Vector}

HeatMap.js, line 408

Convert to the iClient features.

Name Type Description
features GeoJSONObject | Array.<ol.Feature>

The pending features include the GeoJOSN specification data type, and the ol.feature type.

Returns:
Type Description
SuperMap.Feature.Vector The converted iClient features.