Skip to main content

AggregationLayer (Experimental)

AggregationLayer is the base class for all layers in @deck.gl/aggregation-layers module. It implements the most common tasks for aggregation with flexibility of customizations.

AggregationLayer extends CompositeLayer.

Methods​

Any layer subclassing the AggregationLayer must implement the following methods:

getAggregatorType​

Returns a string that indicates the type of aggregator that this layer uses, for example 'gpu'. The aggregator type is re-evaluated every time the layer updates (usually due to props or state change). If the type string does not match its previous value, any existing aggregator will be disposed,and createAggregator is called to create a new instance.

createAggregator​

Arguments:

  • type (string) - return value from getAggregatorType()

Returns a Aggregator instance. This instance will be accessible via this.state.aggregator.

onAttributeChange​

Arguments:

  • attributeId (string) - the id of an attribute that has been updated

This event handler should be used to update the props of the aggregator, if needed, and call aggregator.setNeedsUpdate to request an update.

renderLayers​

Returns a list of sub layers.

Aggregation results can be obtained here with aggregator.getBins, aggregator.getResult and aggregator.getResultDomain.

Source​

modules/aggregation-layers/src/common/aggregation-layer.ts