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.
| Name | Type | Description |
|---|---|---|
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:
-
If
H.clustering.Provider.Strategy.DYNAMICGRIDstrategy is used with the projection other than defaultH.geo.mercatorprojection.
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);
Extends
Members
-
This enumeration represents identifiers for possible clustering strategies.
Properties:
Name Description FASTGRIDThis strategy implements an efficient way to cluster large sets of data points.
GRIDThis strategy is slower but has greater precision due to a bigger range of epsilon values.
DYNAMICGRIDThis strategy uses the same algorithm of clustering as the
GRID, but clusters on the viewport basis and utilizes Web Workers for a better performance. It is best suited for data sets that are subject to frequent updates. -
max number inherited
-
This property holds a value indicating the maximum zoom level at which the given provider can serve data. The value is set at construction time.
-
min number inherited
-
This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time.
-
uid string inherited
-
This property holds the unique identifier for the provider instance. The value is generated at construction time.
-
uri string inherited
-
This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's
uid.
Methods
-
This method adds a data point to the provider. Note that this method triggers re-clustering of the the data set associated with the provider.
Name Type Description dataPointH.clustering.DataPoint An object representing the data point to add
-
This method adds a list of data points to the provider. Note that this method triggers re-clustering of the data set associated with the provider.
Name Type Description dataPointsArray.<!H.clustering.DataPoint> A set of data point objects to add
-
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method adds a listener for a specific event.
Note that to prevent potential memory leaks, you must either call
removeEventListenerordisposeon the given object when you no longer need it.Name Type Description typestring The name of the event
handlerfunction An event handler function
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject optional An object defining the scope for the handler function
-
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which is triggered when the
EventTargetobject is being disposed.Name Type Description callbackfunction The callback function.
opt_scopeObject optional An optional scope for the callback function
-
dispatchEvent (evt) inherited
-
This method dispatches an event on the
EventTargetobject.Name Type Description evtH.util.Event | string An object representing the event or a string with the event name
-
dispose () inherited
-
This method removes listeners from the given object. Classes that extend
EventTargetmay need to override this method in order to remove references to DOM Elements and additional listeners. -
getCopyrights (boundingBox, level)Array.<!H.map.ICopyright> inherited
-
This method retrieves the copyrights for the provided content for a certain geographical area and zoom level.
Note: This function may be overridden by
H.map.provider.Provider.OptionsgetCopyrightsproperty. The default implementation returnsnull.Name Type Description boundingBoxH.geo.Rect The rectangular area for which to retrieve the copyright information
levelnumber The zoom level for which to retrieve the copyright information
Returns:
Type Description Array.<!H.map.ICopyright> A list of copyright information objects for the provided area and zoom level -
getInvalidations (opt_type)H.map.provider.Invalidations inherited
-
This method retrieves the accumulated invalidations of the given provider's objects.
Name Type Description opt_typeH.map.Object.Type optional The type of objects to consider for the invalidations. If undefined, all types are taken into account.
Returns:
Type Description H.map.provider.Invalidations An object specifying invalidations -
getObjectsWithin (area, callback, options) inherited
-
To obtain a list of map objects which intersect the provided area.
Name Type Description areaH.geo.Polygon The polygonal geographical area where to obtain the map objects. Since the polygon's legs are not projected, for some areas covering several latitude degrees the set of objects retrieved is not guaranteed to be what is shown in the map.
callbackfunction(!Array.<!H.map.Object>) The function to invoke when the request operation has been finished. It gets a list of all found objects as argument.
optionsH.map.provider.LocalObjectProvider.GetObjectsWithinOptions Additional options to filter the obtained map objects
-
getRootGroup ()H.map.Group inherited
-
This method retrieves the root group for the given provider.
Returns:
Type Description H.map.Group An object representing the root group for the given provider -
getStyleInternal ()H.map.render.Style.<!Object> inherited
-
This methods returns the style used to render the provider data.
Returns:
Type Description H.map.render.Style.<!Object> -
getTheme ()H.clustering.ITheme
-
This method retrieves the current theme used for cluster visualizations.
Returns:
Type Description H.clustering.ITheme An object representing the clustering scheme -
invalidateObject (mapObject, changes) inherited
-
This method signals to the provider that a map object has changed. The method updates the
Invalidationsof the given provider and the specified map object and triggersdispatchUpdate().Name Type Description mapObjectH.map.Object The map object to be invalidated
changesH.math.BitMask.<!H.map.provider.Invalidations.Flag> The flags indicating the types of changes that have occurred
-
This method checks whether this provider will provide
DomMarkermap objects. A concrete implementation ofProvidermust override it if it will provideDomMarkers.Returns:
Type Description boolean A value indicating if the given provider provides DomMarkers ( true) or not (false) -
providesGeoJSON ()boolean inherited
-
This method checks whether this provider will provide data in
GeoJSONformat. A concrete implementation ofProvidermust override it if it will provideGeoJSONdata.Returns:
Type Description boolean A value indicating if the given provider provides GeoJSONdata (true) or not (false) -
This method checks whether this provider will provide
Markermap objects. A concrete implementation ofProvidermust override it if it will provideMarkers.Returns:
Type Description boolean A value indicating if the given provider provides Markers ( true) or not (false) -
providesOMV ()boolean inherited
-
This method checks whether this provider will provide data in
OMVformat. A concrete implementation ofProvidermust override it if it will provideOMVdata.Returns:
Type Description boolean A value indicating if the given provider provides OMVdata (true) or not (false) -
providesOverlays ()boolean inherited
-
This method checks whether this provider will provide overlay map objects. A concrete implementation of
Providermust override it if it will provide overlays.Returns:
Type Description boolean trueif the provider provides overlays, otherwisefalse -
providesRasters ()boolean inherited
-
This method checks whether this provider will provide bitmap images as tiles. A concrete implementation of
Providermust override it if it will provide raster tiles.Returns:
Type Description boolean A value indicating if the given provider provides raster tiles ( true) or not (false) -
This method checks whether this provider will provide spatial map objects. A concrete implementation of
Providermust override it if it will provideSpatials.Returns:
Type Description boolean A value indicating whether the provider provides map objects ( true) or not (false) -
This method removes a data point from the provider's data set. Note that this method triggers re-clustering of the data set associated with the provider.
Name Type Description dataPointH.clustering.DataPoint An object representing the data point to remove
-
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the
EventTargetinstance.Name Type Description typestring The name of the event
handlerfunction A previously added event handler
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject optional An object defining the scope for the handler function
-
removeObject (object) Deprecated : since version 3.1.11.1 inherited
-
This method removes an object from the given provider's database. It must not called directly. It is invoked by
H.map.Groupwhich checks beforehand that it is anH.map.Objectinstance and its provider is the given provider.Name Type Description objectH.map.Object The object to remove
-
requestDomMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.DomMarker> inherited
-
This method retrieves all
DomMarkermap objects which intersect with the provided rectangular area.Name Type Description geoRectH.geo.Rect A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
zoomLevelnumber | undefined The zoom level for which the objects are requested, or
undefinedto retrieve all objects for any zoom levelvisiblesOnlyboolean Indicates whether only objects that are effectively visible are requested
cacheOnlyboolean A value indicating whether only cached objects are to be considered (
true) or not (false)Returns:
Type Description Array.<!H.map.DomMarker> A list of intersecting objects -
requestMarkers (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Marker> inherited
-
This method retrieves all
Markermap objects which intersect with the provided rectangular area.Name Type Description geoRectH.geo.Rect A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
zoomLevelnumber | undefined The zoom level for which the objects are requested, or
undefinedto retrieve all objects for any zoom levelvisiblesOnlyboolean Indicates whether only objects that are effectively visible are requested
cacheOnlyboolean A value indicating whether only cached objects are to be considered (
true) or not (false)Returns:
Type Description Array.<!H.map.Marker> A list of intersecting objects -
requestOverlays (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Overlay> inherited
-
This method retrieves all overlay objects which intersect with the specified area.
Name Type Description geoRectH.geo.Rect A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
zoomLevelnumber | undefined The zoom level for which the objects are requested, or
undefinedto retrieve all objects for any zoom levelvisiblesOnlyboolean Indicates whether only objects that are effectively visible are requested
cacheOnlyboolean A value indicating whether only cached objects are to be considered (
true) or not (false)Returns:
Type Description Array.<!H.map.Overlay> A list of intersecting objects -
requestSpatials (geoRect, zoomLevel, visiblesOnly, cacheOnly)Array.<!H.map.Spatial> inherited
-
This method retrieves all polyline, polygon, circle and rectangle objects which intersect with the provided area.
Name Type Description geoRectH.geo.Rect A rectangular area defined in terms of the geographic coordinates of its top-left and bottom-right corners
zoomLevelnumber | undefined The zoom level for which the objects are requested, or
undefinedto retrieve all objects for any zoom levelvisiblesOnlyboolean Indicates whether only objects that are effectively visible are requested
cacheOnlyboolean A value indicating whether only cached objects are to be considered (
true) or not (false)Returns:
Type Description Array.<!H.map.Spatial> A list of intersecting objects -
This method sets a new data on the provider class.
Name Type Description dataPointsArray.<!H.clustering.DataPoint> A set of data points
-
setStyleInternal (style, opt_suppressChangeEvent) inherited
-
This method sets the style to be used to render the provider data.
Name Type Description styleH.map.render.Style.<!Object> The style to use for rendering the provider data.
opt_suppressChangeEventboolean optional Flag to suppress firing of config change event.
-
This method sets new theme on the provider. Note that this method changes the visual representation of the displayed clusters and noise points.
Name Type Description themeH.clustering.ITheme An object representing the theme to set
Type Definitions
-
This type encapsulates configuration (initialization) options which are used in cluster calculations.
Properties:
Name Type Argument Description epsnumber <optional>
The epsilon parameter for cluster calculations. For the
FASTGRIDstrategy, it must not exceed 256 and must take values that are a power of 2. For theGRIDandDYNAMICGRIDstrategies, it can take values from 10 to 127. The Default is32.minWeightnumber <optional>
The minimum point weight sum to form a cluster, the default is
2.projectionH.geo.IProjection <optional>
The projection to use for clustering, the default is
H.geo.mercator.strategyH.clustering.Provider.Strategy <optional>
The identifier of the clustering strategy, defaults to
H.clustering.Provider.Strategy.FASTGRID. -
This type defines options that can be used for
H.map.provider.LocalObjectProvider#getObjectsWithincalls.Properties:
Name Type Argument Description zoomnumber The zoom level for which the objects are requested.
visiblesOnlyboolean <optional>
Indicates whether only objects that are effectively visible are requested. The default value is
true.typesH.math.BitMask.<H.map.Object.Type> To specify which types of map objects are requested. For example:
types: H.map.Object.Type.MARKER | H.map.Object.Type.SPATIALThe default value isH.map.Object.Type.ANY. -
This type encapsulates configuration (initialization) options the clustering
Provider.Properties:
Name Type Argument Description uristring <optional>
The provider's unique resource identifier which must not contain an underscore
"_". If omitted, an auto-generated unique session ID is used. If a consistent ID across sessions is needed (for example for storing provider data), this property must be specified.minnumber <optional>
The minimum supported zoom level, the default is
0.maxnumber <optional>
The maximum supported zoom level, the default is
22.pixelRationumber <optional>
The pixel ratio to use for over-sampling in cases of high-resolution displays, the default is
window.devicePixelRatio.getCopyrightsfunction <optional>
A function to replace the default implementation of
H.map.provider.Provider#getCopyrights.clusteringOptionsH.clustering.Provider.ClusteringOptions <optional>
Configuration options for clustering algorithm.
themeH.clustering.ITheme <optional>
An object that determines the visual representation for clusters and noise points.
Events
-
update inherited
-
Event fired when this provider's data updates.
Type: