Display a web map with a point feature layer that has feature reduction enabled to aggregate points into clusters.
Feature clustering can be used to dynamically aggregate groups of points that are within proximity of each other in order to represent each group with a single symbol. Such grouping allows you to see patterns in the data that are difficult to visualize when a layer contains hundreds or thousands of points that overlap and cover each other.
Pan and zoom the map to view how clustering is dynamically updated. Toggle clustering off to view the original point features that make up the clustered elements. When clustering is on, you can tap on a clustered geoelement to view aggregated information and summary statistics for that cluster. When clustering is toggled off and you tap on the original feature you get access to information about individual power plant features.
- Create a map from a web map
PortalItem
. - Get the cluster enabled layer from the map's operational layers.
- Get the
FeatureReduction
from the feature layer and set theIsEnabled
bool to enable or disable clustering on the feature layer. - When the user clicks on the map, call
IdentifyFeatureLayerAsync()
, passing in the layer, map tap location, tolerance, andreturnPopupsOnly
as true. - Set the
Popup
from the resultingIdentifyLayerResult
to thePopupViewer.Popup
. - Make the
PopupViewer
visible.
- AggregateGeoElement
- FeatureLayer
- FeatureReduction
- GeoElement
- IdentifyLayerResult
This sample uses a web map that displays the Esri Global Power Plants feature layer with feature reduction enabled. When enabled, the aggregate features symbology shows the color of the most common power plant type, and a size relative to the average plant capacity of the cluster.
Graphics in a graphics overlay can also be aggregated into clusters. To do this, set the FeatureReduction
property on the GraphicsOverlay
to a new ClusteringFeatureReduction
.
aggregate, bin, cluster, group, merge, normalize, reduce, summarize