Skip To ContentArcGIS for DevelopersSign In Dashboard

clusters

require(["esri/smartMapping/popup/clusters"], function(clusterPopupTemplateCreator) { /* code goes here */ });
Object: esri/smartMapping/popup/clusters
Since: ArcGIS API for JavaScript 4.16

This object contains helper methods for generating popup templates to be set on a layer's FeatureReductionCluster. 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.

clustering-generated-popup

For layers with a UniqueValueRenderer, the popup will include the predominant unique value info of features in the cluster.

clustering-types-popup

This module only applies to layers with a point geometry type.

Method Overview

NameReturn TypeSummaryObject
Promise<Templates>

Returns one or more suggested default popupTemplates for a given layer's FeatureReductionCluster configuration.

more details
more detailsclusters

Method Details

getTemplates(params){Promise<Templates>}

Returns one or more suggested default popupTemplates for a given layer's FeatureReductionCluster 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.

Parameters:
Specification:
params Object

See the table below for details of each parameter that may be passed to this function.

Specification:

The point layer that is or will be clustered.

renderer Renderer
optional

Specify the renderer to be used on the layer when featureReduction is enabled if it will be different than the renderer already set on the layer.

Returns:
TypeDescription
Promise<Templates>Returns an object containing suggested primary and secondary PopupTemplates for the input layer's featureReduction property.
Example:
// Sets a suggested popupTemplate on the layer's clusters
clusterPopupTemplateCreator.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);
});

API Reference search results

NameTypeModule
Loading...