We added support for clustering point features in FeatureLayer
and CSVLayer
. Clustering
is a method of aggregating point features so fewer of them display in the view. This can help reveal
potential spatial patterns present in the data that might otherwise not be immediately apparent if displaying all points with the same symbol.
For example, the image on the right clusters points based on a given amount of screen space, thus decluttering the view and providing a snapshot
of where more features are located in relation to others.
No clustering | Clustering |
When a cluster is clicked, a popup appears, summarizing the features that comprise the cluster. Users are provided with the ability to browse individual features by clicking the Browse Features option at the bottom of the popup. This capability allows you to view popup information for individual features as well as their actual location on the map.
In the API, clustering is referred to as featureReduction
. Each of the supported layer types allows the developer to set featureReduction options
in the constructor. They may also be set via the setFeatureReduction() method
of the layer.
featureLayer.setFeatureReduction({ type: "cluster", clusterRadius: 60 // the pixel radius for determining which features belong in each cluster });
Note that featureReduction
is a property of the layer, not the renderer. That means that any renderer (with the exception of HeatmapRenderer),
retains its visualization properties on the layer even when clustering is enabled. If you set a renderer with a
colorInfo visual variable on a layer, for example, and enable clustering, then the clusters will
average the numeric value driving the color visualization and shade the clusters based on the average value. The popup will then
display a summary of the features based on the given renderer field. Size, opacity, and rotation visual variables are handled in the same manner.
In the case of UniqueValueRenderer, each cluster will be shaded with the color representing the predominant value among the features comprising the cluster.
The following are new samples demonstrating feature reduction:
Support for feature reduction is limited to the following scenarios:
HeatmapRenderer
,
BlendRenderer
, TemporalRenderer
, or
ScaleDependentRenderer
.featureReduction
on class FeatureLayer
and CSVLayer
.setFeatureReduction()
on class FeatureLayer
and CSVLayer
.getFeatureReduction()
on class FeatureLayer
and CSVLayer
.isFeatureReductionEnabled()
on class FeatureLayer
and CSVLayer
.enableFeatureReduction()
on class FeatureLayer
and CSVLayer
.disableFeatureReduction()
on class FeatureLayer
and CSVLayer
.isFeatureReductionActive()
on class FeatureLayer
and CSVLayer
.getAggregateGraphics()
on class FeatureLayer
and CSVLayer
.getSingleGraphics()
on class FeatureLayer
and CSVLayer
.isAggregate()
on class Graphic
.getChildGraphics()
on class Graphic
.clone()
on class Graphic
.clusterFillSymbol
on class Popup
.addActions()
on class Popup
.removeActions()
on class Popup
.getCurrentAnchor()
on class Popup
.options
on method Popup.setFeatures()
.returnFieldName
on class IdentifyParameters
.returnUnformattedValues
on class IdentifyParameters
.network-link-error
on class KMLLayer
.location
.refreshInterval
property to the mediaInfos object.
imageData
or url
properties.WebTiledLayer
missing an LOD for level 0 wouldn't display in Chrome browser. This was an issue for some tianditu.com layers.Version 3.22 of the ArcGIS API for JavaScript include:
dgrid1
directory, whereas version 0.3.17 should reference the dgrid
directory.
Please refer to the dgrid 0.4 Migration Guide for additional information on migrating to the newer version.
Use the repository on GitHub for the JS API TypeScript definitions.