import { getTemplates } from "@arcgis/core/smartMapping/popup/clusters.js";const { getTemplates } = await $arcgis.import("@arcgis/core/smartMapping/popup/clusters.js");- Since
- ArcGIS Maps SDK for JavaScript 4.16
This object contains helper methods for generating popup templates to be set on a layer's FeatureReductionCluster.popupTemplate. The suggested popup templates will include summary information about features in the cluster based on the layer's renderer. For example, in a layer visualizing population, the cluster popup template will include the number of features in the cluster and the average population of features in the cluster.

For layers with a UniqueValueRenderer, the popup will include the predominant unique value info of features in the cluster.
This module only applies to layers with a point geometry type.
Functions
| Name | Return Type | Object |
|---|---|---|
| | ||
| |
getTemplates
Returns one or more suggested default popupTemplates for a given layer's FeatureReductionCluster.popupTemplate configuration. The cluster popup will contain information describing features in the cluster, including the number of features in the cluster and summary statistics based on fields and expressions used in the layer's renderer.
- Signature
-
getTemplates (parameters: TemplateParameters): Promise<Templates | null | undefined>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| parameters | The function parameters. | |
Example
// Sets a suggested popupTemplate on the layer's clustersclusterPopupTemplateCreator.getTemplates({ layer: featureLayer, renderer: featureLayer.renderer}).then(function(popupTemplateResponse){ const featureReduction = featureLayer.featureReduction.clone(); featureReduction.popupTemplate = popupTemplateResponse.primaryTemplate.value; featureLayer.featureReduction = featureReduction;}).catch(function(error){ console.error(error);});