heatmap
require(["esri/renderers/smartMapping/creators/heatmap"], function(heatmapRendererCreator) { /* code goes here */ });esri/renderers/smartMapping/creators/heatmapThis object contains a helper method for generating a HeatmapRenderer for a point Layer.
It is important to note that the input layer must have features available in the input view for the createRenderer() method to generate a meaningful heatmap. Otherwise, the method will fail.
Known Limitations
- HeatmapRenderer is not currently supported in 3D SceneViews.
- Only FeatureLayer, GeoJSONLayer, and CSVLayer layer types with point geometries are supported.
Method Overview
| Name | Return Type | Summary | Object | |
|---|---|---|---|---|
| Promise<HeatmapRendererResult> | Generates a HeatmapRenderer that may be applied directly to the layer used to call this method.more details | more details | heatmap | 
Method Details
- createRenderer(params){Promise<HeatmapRendererResult>}
- Generates a HeatmapRenderer that may be applied directly to the layer used to call this method. The renderer represents points as a continuous surface using optimal colors for the indicated basemap. - This method should be called when at least some points are visible in the input view's extent. If no points are visible in the view, then the response will not return a useful visualization. - In most cases you will provide a - layer,- basemap, and optional- fieldto generate this renderer. This is a scenario in which the statistics and the distribution of the data aren't well known and the user doesn't know what colors to use in the visualization.- The other options are provided for convenience for more involved custom visualization authoring applications. For example, if you already generated statistics in another operation, you can pass the statistics object to the - statisticsparameter to avoid making an extra call to the server.Parameters:Specification:params Object- Input parameters for generating a heatmap visualization based on data returned from a given field. See the table below for details of each parameter. Specification:layer FeatureLayer|CSVLayer|GeoJSONLayer- The point layer for which the visualization is generated. view MapView- The view instance in which the visualization will be rendered. field Stringoptional- The name of the field whose data will be queried for statistics and used for the basis of the data-driven visualization. The value of the - fieldis used as a multiplier in the heatmap, making areas with high field values hotter than areas where the features have low field values.Deprecated since version 4.13. Useoptional- viewinstead.Default Value: gray- The named string or basemap object of the Esri basemap that will be paired with the output visualization. Determines optimal colors for the output renderer. heatmapScheme HeatmapSchemeoptional- In authoring apps, the user may select a pre-defined heatmap scheme. Pass the scheme object to this property to avoid getting one based on the - basemap.statistics HeatmapStatisticsResultoptional- A statistics object generated from the heatmapStatistics function. If statistics for the field have already been generated, then pass the object here to avoid making a second statistics query to the server. fadeToTransparent BooleanoptionalDefault Value: true- Indicates whether to fade the lower color stops to a transparent color to create a fuzzy boundary on the edge of the heatmap. A value of - falsemakes a discrete boundary on the lower color stop.blurRadius NumberoptionalDefault Value: 10- The blurRadius in pixels that determines the area of influence of each point. A higher blur radius indicates points have more influence on surrounding points. minRatio NumberoptionalDefault Value: 0.01- The minimum ratio used in the HeatmapRenderer.colorStops of the output renderer. maxRatio NumberoptionalDefault Value: 1- The maximum ratio used in the HeatmapRenderer.colorStops of the output renderer. Returns:- Type - Description - Promise<HeatmapRendererResult> - Resolves to an instance of HeatmapRendererResult. Example:- var earthquakeLayer = new FeatureLayer({ // url to a point dataset }); // visualization based on field var heatmapParams = { layer: earthquakeLayer, view: view, field: "magnitude" }; // when the promise resolves, apply the renderer to the layer heatmapRendererCreator.createRenderer(heatmapParams) .then(function(response){ earthquakeLayer.renderer = response.renderer; });
Type Definitions
- HeatmapRendererResult
- The result object of the createRenderer() method. See the table below for details of each property. - Properties:
- renderer HeatmapRendererThe renderer object configured to best match the given basemap and the spread of the data. Set this on a layer's rendererproperty to update its visualization.scheme HeatmapSchemeThe color scheme used by the renderer. defaultValuesUsed BooleanIndicates whether default values are used in the absence of sufficient data and/or statistics from the layer. Default values are typically used when all features have the same field value or no value at all. statistics HeatmapStatisticsResultBasic statistics returned from a query to the service for data from the given field name. basemapId StringThe ID of the basemap used to determine the optimal color stops of the heatmap. basemapTheme StringIndicates whether the average color of the input view's basemap is lightordark.