Skip To ContentArcGIS for DevelopersSign In Dashboard
Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to enable point clustering on a GeoJSONLayer. Clustering is a method of reducing points in a FeatureLayer, CSVLayer, or GeoJSONLayer by grouping them into clusters based on their spatial proximity to one another. Typically, clusters are proportionally sized based on the number of features within each cluster.

Clustering is configured in the featureReduction property of the layer. The area of influence that determines each cluster's region for including features is defined by the clusterRadius. You may also define popupTemplates for clusters that summarize the features comprised by the cluster.

layer.featureReduction = {
  type: "cluster",
  clusterRadius: "100px",
  popupTemplate: {
    // cluster_count is an aggregate field indicating the number
    // of features summarized by the cluster
    content: "This cluster represents {cluster_count} earthquakes."
  }
}

Point clustering only applies to layers with point geometries in a MapView containing either a SimpleRenderer, UniqueValueRenderer, or a ClassBreaksRenderer. It does not apply to layers with polyline and polygon geometries.

Clustering layers with spatial references other than Web Mercator and WGS-84 is experimental and may not work for every projection. Clustered layers that have spatial references other than Web Mercator or WGS-84 have the same limitations listed in the projection engine documentation, including no support in Internet Explorer.

Click here to read more information about clustering limitations.

Sample search results

TitleSample
Loading...