Class ClusteringFeatureReduction

All Implemented Interfaces:
PopupSource

public final class ClusteringFeatureReduction extends AggregationFeatureReduction
Method for aggregating and summarizing features in a point FeatureLayer or point graphics in a GraphicsOverlay in dynamic rendering mode (FeatureLayer.RenderingMode.DYNAMIC, or GraphicsOverlay.RenderingMode.DYNAMIC).

Clustering is configured via the FeatureLayer.featureReductionProperty() property of the FeatureLayer or the GraphicsOverlay.featureReductionProperty() of the GraphicsOverlay.

Feature clustering allows you to visually represent large numbers of point geoelements in relatively small areas by aggregating them into clusters. Each cluster of two or more points is represented with an AggregateGeoElement that has its own symbol. If a point feature is not clustered, it continues to draw as an individual feature using the layer's renderer. As a user navigates the map, clusters update dynamically depending on the map's scale and extent. Feature clustering only applies to layers with point geometries in a 2D map. It does not apply to layers with polyline and polygon geometries and is not supported in 3D.

In such unsupported scenarios, the original features or graphics are drawn. In case of FeatureLayer, a LayerViewState is bubbled up indicating the appropriate error. The symbol for the cluster is determined by the renderer passed to ClusteringFeatureReduction and cluster symbol size is determined by the minSymbolSizeProperty() and maxSymbolSizeProperty() properties. At present, this API does not support configuring cluster symbol size from another AggregateField.

Since:
200.2.0
  • Property Details

    • maxSymbolSize

      public DoubleProperty maxSymbolSizeProperty
      The symbol size of the largest cluster in device-independent pixels. The default value is 70.

      The ClusteringFeatureReduction#maxSymbolSizeProperty() and radiusProperty() complement each other. If you adjust one, you should adjust the other (a larger ClusteringFeatureReduction.maxSymbolSizeProperty() should have a larger ClusteringFeatureReduction.radiusProperty()). Note, if a custom renderer is defined for clusters and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: Changing this property causes data to be re-clustered.

      The maxSymbolSize value must be a non-negative number.

      Since:
      200.3.0
      See Also:
    • minSymbolSize

      public DoubleProperty minSymbolSizeProperty
      The symbol size of the smallest cluster in device-independent pixels. The default value is 12.

      If a custom renderer is defined for the clusters, and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: changing this property causes data to be re-clustered.

      The minSymbolSize value must be a non-negative number.

      Since:
      200.3.0
      See Also:
    • radius

      public DoubleProperty radiusProperty
      The radius in device-independent pixels of the area in which multiple points will be grouped and visualized as a single cluster. The default value is 60.

      If you don't want cluster graphics to overlap, the radiusProperty() should be larger than the maxSymbolSizeProperty(). Note: changing this property causes data to be re-clustered.

      The radius value must be a non-negative number.

      Since:
      200.3.0
      See Also:
  • Constructor Details

    • ClusteringFeatureReduction

      public ClusteringFeatureReduction(Renderer renderer)
      Creates a ClusteringFeatureReduction object using the given renderer and default values for min size, max size and radius of the cluster.

      Only SimpleRenderer, UniqueValueRenderer, and ClassBreaksRenderer are currently supported for AggregationFeatureReduction.rendererProperty(). UniqueValueRenderer with multiple fields is not supported. If the renderer passed is not one of the supported renderer types listed above, then original features from the FeatureLayer or original graphics from the GraphicsOverlay are drawn using FeatureLayer.getRenderer() or GraphicsOverlay.getRenderer() respectively. In case of FeatureLayer, a LayerViewState that contains an error indicating the use of an unsupported renderer is bubbled up. Also note, AggregationFeatureReduction.rendererProperty() is independent of FeatureLayer.rendererProperty() and GraphicsOverlay.rendererProperty().

      If you want to symbolize clusters using the same symbology used by the FeatureLayer or GraphicsOverlay, you may clone FeatureLayer.rendererProperty() or GraphicsOverlay.rendererProperty() and set it here. You can also create a new renderer of a supported type. If you create a new SimpleRenderer, clusters will be drawn using the symbol defined for the SimpleRenderer. If the new renderer is of type ClassBreaksRenderer or UniqueValueRenderer, the field name on the renderer must match one of the AggregateField in AggregationFeatureReduction.getAggregateFields(). If this field is not found in AggregationFeatureReduction.getAggregateFields(), the cluster will be drawn using ClassBreaksRenderer.getDefaultSymbol() or UniqueValueRenderer.getDefaultSymbol(). If there is no default symbol defined, clusters will not be drawn.

      Parameters:
      renderer - the renderer for drawing clustered geoelements
      Throws:
      NullPointerException - if renderer is null
      Since:
      200.3.0
  • Method Details

    • maxSymbolSizeProperty

      public DoubleProperty maxSymbolSizeProperty()
      The symbol size of the largest cluster in device-independent pixels. The default value is 70.

      The ClusteringFeatureReduction#maxSymbolSizeProperty() and radiusProperty() complement each other. If you adjust one, you should adjust the other (a larger ClusteringFeatureReduction.maxSymbolSizeProperty() should have a larger ClusteringFeatureReduction.radiusProperty()). Note, if a custom renderer is defined for clusters and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: Changing this property causes data to be re-clustered.

      The maxSymbolSize value must be a non-negative number.

      Returns:
      the maxSymbolSize property
      Since:
      200.3.0
      See Also:
    • getMaxSymbolSize

      public double getMaxSymbolSize()
      Gets the value of the maxSymbolSize property.
      Property description:
      The symbol size of the largest cluster in device-independent pixels. The default value is 70.

      The ClusteringFeatureReduction#maxSymbolSizeProperty() and radiusProperty() complement each other. If you adjust one, you should adjust the other (a larger ClusteringFeatureReduction.maxSymbolSizeProperty() should have a larger ClusteringFeatureReduction.radiusProperty()). Note, if a custom renderer is defined for clusters and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: Changing this property causes data to be re-clustered.

      The maxSymbolSize value must be a non-negative number.

      Returns:
      the value of the maxSymbolSize property
      Since:
      200.3.0
      See Also:
    • setMaxSymbolSize

      public void setMaxSymbolSize(double maxSymbolSize)
      Sets the value of the maxSymbolSize property.
      Property description:
      The symbol size of the largest cluster in device-independent pixels. The default value is 70.

      The ClusteringFeatureReduction#maxSymbolSizeProperty() and radiusProperty() complement each other. If you adjust one, you should adjust the other (a larger ClusteringFeatureReduction.maxSymbolSizeProperty() should have a larger ClusteringFeatureReduction.radiusProperty()). Note, if a custom renderer is defined for clusters and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: Changing this property causes data to be re-clustered.

      The maxSymbolSize value must be a non-negative number.

      Parameters:
      maxSymbolSize - the value for the maxSymbolSize property
      Since:
      200.3.0
      See Also:
    • minSymbolSizeProperty

      public DoubleProperty minSymbolSizeProperty()
      The symbol size of the smallest cluster in device-independent pixels. The default value is 12.

      If a custom renderer is defined for the clusters, and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: changing this property causes data to be re-clustered.

      The minSymbolSize value must be a non-negative number.

      Returns:
      the minSymbolSize property
      Since:
      200.3.0
      See Also:
    • getMinSymbolSize

      public double getMinSymbolSize()
      Gets the value of the minSymbolSize property.
      Property description:
      The symbol size of the smallest cluster in device-independent pixels. The default value is 12.

      If a custom renderer is defined for the clusters, and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: changing this property causes data to be re-clustered.

      The minSymbolSize value must be a non-negative number.

      Returns:
      the value of the minSymbolSize property
      Since:
      200.3.0
      See Also:
    • setMinSymbolSize

      public void setMinSymbolSize(double minSymbolSize)
      Sets the value of the minSymbolSize property.
      Property description:
      The symbol size of the smallest cluster in device-independent pixels. The default value is 12.

      If a custom renderer is defined for the clusters, and that renderer contains size visual variables, this property is ignored and cluster sizes are determined using the cluster renderer's size variable. Note: changing this property causes data to be re-clustered.

      The minSymbolSize value must be a non-negative number.

      Parameters:
      minSymbolSize - the value for the minSymbolSize property
      Since:
      200.3.0
      See Also:
    • radiusProperty

      public DoubleProperty radiusProperty()
      The radius in device-independent pixels of the area in which multiple points will be grouped and visualized as a single cluster. The default value is 60.

      If you don't want cluster graphics to overlap, the radiusProperty() should be larger than the maxSymbolSizeProperty(). Note: changing this property causes data to be re-clustered.

      The radius value must be a non-negative number.

      Returns:
      the radius property
      Since:
      200.3.0
      See Also:
    • getRadius

      public double getRadius()
      Gets the value of the radius property.
      Property description:
      The radius in device-independent pixels of the area in which multiple points will be grouped and visualized as a single cluster. The default value is 60.

      If you don't want cluster graphics to overlap, the radiusProperty() should be larger than the maxSymbolSizeProperty(). Note: changing this property causes data to be re-clustered.

      The radius value must be a non-negative number.

      Returns:
      the value of the radius property
      Since:
      200.3.0
      See Also:
    • setRadius

      public void setRadius(double radius)
      Sets the value of the radius property.
      Property description:
      The radius in device-independent pixels of the area in which multiple points will be grouped and visualized as a single cluster. The default value is 60.

      If you don't want cluster graphics to overlap, the radiusProperty() should be larger than the maxSymbolSizeProperty(). Note: changing this property causes data to be re-clustered.

      The radius value must be a non-negative number.

      Parameters:
      radius - the value for the radius property
      Since:
      200.3.0
      See Also: