Maps API for JavaScript Developer's Guide

H.clustering.Provider

Class Summary

Extends: H.util.EventTarget

The clustering provider serves clusters and noise point representation for the map based on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

min : {number}

Minimum zoom level at which provider can cluster data

max : {number}

Maximum zoom level at which provider can cluster data

Method Summary

Table 2. Methods
Methods

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

dispatchEvent (evt)

This method will dispatch event on the event target object

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

setDataPoints (dataPoints)

This method sets a new data on the provider class.

addDataPoint (dataPoint)

This method adds a data point to the provider. Note that this method triggers reclustering of the the data set associated with the provider.

addDataPoints (dataPoints)

This method adds a list of data points to the provider. Note that this method triggers reclustering of the data set associated with the provider.

removeDataPoint (dataPoint)

This method removes a data point from the provider's data set. Note that this method triggers reclustering of the data set associated with the provider.

getTheme () : {H.clustering.ITheme}

This method retrieves the current theme used for cluster visualizations.

setTheme (theme)

This method sets new theme on the provider. Note that this method changes the visual representation of the displayed clusters and noise points.

providesDomMarkers () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

requestDomMarkers (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}

Returns all DomMarker cluster and noise point representations which intersect with the provided rectangular area.

providesMarkers () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

requestMarkers (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}

Returns all cluster and noise point markers which intersect with the provided rectangular area.

providesSpatials () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

requestSpatials (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}

Returns all polyline, polygon, circle and rect objects which represent cluster and noise points and intersect with the provided area.

requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}

Returns the spatial objects which intersect the given tile

getInvalidations () : {H.map.provider.Invalidations}

Returns the accumulate invalidations of this provider's objects that have occurred.

invalidateObject (mapObject, changes)

To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the given map object and triggers dispatchUpdate()

Class Description

The clustering provider serves clusters and noise point representation for the map based on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options.

Example

var dataPoints = [
  new H.clustering.DataPoint(52, 1),
  new H.clustering.DataPoint(52.1, 1)
];

var clusteringProvider = new H.clustering.Provider(dataPoints, {
  clusteringOptions: {
   minWeight: 1,
   eps: 32
  }
});
// clustering should be used with ObjectLayer
var clusteringLayer = new H.map.layer.ObjectLayer(clusteringProvider);
map.addLayer(clusteringLayer);

Constructor Details

H.clustering.Provider(dataPoints, opt_options)

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
An array of objects representing data points
opt_options:
{H.clustering.Provider.Options=} [optional]
 
An object containing configuration options
Throws:
 
{H.lang.InvalidArgumentError}
 
If H.clustering.Provider.Strategy.DYNAMICGRID strategy is used with the projection other than default H.geo.mercator projection.

Property Details

min: {number}

Minimum zoom level at which provider can cluster data

max: {number}

Maximum zoom level at which provider can cluster data

Method Details

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
event handler function
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
previously added event handler
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

dispatchEvent (evt)

This method will dispatch event on the event target object

Parameters:
 
evt:
{(H.util.Event | string)}
 
event object or event name

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

Parameters:
 
callback:
{!Function}
 
opt_scope:
{Object=} [optional]
 

setDataPoints (dataPoints)

This method sets a new data on the provider class.

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
A set of data points

addDataPoint (dataPoint)

This method adds a data point to the provider. Note that this method triggers reclustering of the the data set associated with the provider.

Parameters:
 
dataPoint:
{H.clustering.DataPoint}
 
An object representing the data point to add

addDataPoints (dataPoints)

This method adds a list of data points to the provider. Note that this method triggers reclustering of the data set associated with the provider.

Parameters:
 
dataPoints:
{Array<H.clustering.DataPoint>}
 
A set of data point objects to add

removeDataPoint (dataPoint)

This method removes a data point from the provider's data set. Note that this method triggers reclustering of the data set associated with the provider.

Parameters:
 
dataPoint:
{H.clustering.DataPoint}
 
An object representing the data point to remove

getTheme () : {H.clustering.ITheme}

This method retrieves the current theme used for cluster visualizations.

Returns:
 
{H.clustering.ITheme}
An object represening the clustering scheme

setTheme (theme)

This method sets new theme on the provider. Note that this method changes the visual representation of the displayed clusters and noise points.

Parameters:
 
theme:
{H.clustering.ITheme}
 
An object representing the theme to set

providesDomMarkers () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

Returns:
 
{boolean}

requestDomMarkers (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.DomMarker>}

Returns all DomMarker cluster and noise point representations which intersect with the provided rectangular area.

Parameters:
 
bounds:
{H.geo.Rect}
 
A rectangular area in geo space to intersect with
zoomLevel:
{number}
 
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
 
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
 
Indicates whether only cached objects are to be considered
Returns:
 
{Array<H.map.DomMarker>}
a list of intersecting objects

providesMarkers () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

Returns:
 
{boolean}

requestMarkers (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Marker>}

Returns all cluster and noise point markers which intersect with the provided rectangular area.

Parameters:
 
bounds:
{H.geo.Rect}
 
A rectangular area in geo space to intersect with
zoomLevel:
{number}
 
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
 
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
 
Indicates whether only cached objects are to be considered
Returns:
 
{Array<H.map.Marker>}
a list of intersecting objects

providesSpatials () : {boolean}

This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme.

Returns:
 
{boolean}

requestSpatials (bounds, zoomLevel, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}

Returns all polyline, polygon, circle and rect objects which represent cluster and noise points and intersect with the provided area.

Parameters:
 
bounds:
{H.geo.Rect}
 
A rectangular area in geo space to intersect with
zoomLevel:
{number}
 
The zoom level for which the objects are requested
visiblesOnly:
{boolean}
 
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
 
Indicates whether only cached objects are to be considered
Returns:
 
{Array<H.map.Spatial>}
a list of intersecting objects

requestSpatialsByTile (tile, visiblesOnly, cacheOnly) : {Array<H.map.Spatial>}

Returns the spatial objects which intersect the given tile

Parameters:
 
tile:
{H.map.provider.SpatialTile}
 
The tile for which the objects are requested
visiblesOnly:
{boolean}
 
Indicates whether only invisible objects are to be considered
cacheOnly:
{boolean}
 
Indicates whether only cached objects are to be considered
Returns:
 
{Array<H.map.Spatial>}
a list of intersecting objects

getInvalidations () : {H.map.provider.Invalidations}

Returns the accumulate invalidations of this provider's objects that have occurred.

Returns:
 
{H.map.provider.Invalidations}
an invalidations object

invalidateObject (mapObject, changes)

To signal to this provider that a map object has been changed. The method updates the Invalidations of this provider and the given map object and triggers dispatchUpdate()

Parameters:
 
mapObject:
{!H.map.Object}
 
The map object to be invalidated
changes:
{H.math.BitMask}
 
The flags indicating the types of occurred changes

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.