options to configure the ClusterTileLayer
The identifier of the Layer.
default tile margin in pixel
maximum zoom level at which data from the Layer will be displayed.
minimum zoom level at which data from the Layer is displayed.
The name of the Layer
Add an EventListener to the layer. Valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
The detail property of the Event gives additional information about the event. detail.layer is a reference to the layer onto which the event was dispatched and is set for all events.
A string representing the event type to listen for
the listener function that will be called when an event of the specific type occurs
Add a feature to the layer.
the feature to be added to the layer
optional style the feature should be displayed with.
Add features to the layer.
the features to be added to the layer
optional style the features should be displayed with.
Clears the source data provider and all associated clusters, optionally within a specified bounding box.
If no bounding box is provided, all features in the source dataProvider and all clusters will be cleared.
Get a locally cached tile by quadkey.
the quadkey of the tile
Retrieves the cluster to which the specified feature belongs at the given zoom level.
The feature for which to retrieve the cluster.
The zoom level. If not specified, the current map zoom level will be used.
The cluster feature to which the specified feature belongs, or undefined
if no cluster exists.
Retrieves all clusters to which the specified feature belongs across all zoom levels. The returned array is ordered by zoom level in descending order, starting from the ClusterTileLayerOptions.clusterMaxZoom.
The feature for which to retrieve all clusters.
An array of cluster features to which the specified feature belongs, ordered by zoom level.
Retrieves the data provider associated with this ClusterTileLayer.
The data provider is responsible for supplying the features that are to be clustered and displayed within the ClusterTileLayer.
The FeatureProvider
instance used by this layer.
Get provider(s) of this layer.
Get the current layerStyle.
Get styleGroup for the feature.
This method retrieves a StyleGroup for a given feature, optionally based on the specified zoom level and whether to use the layer default styles.
The feature for which to get the styles.
The zoom level to use for determining the styles. This parameter should be set as it determines how styles are applied based on zoom. It is only optional if the style definition supports being applied without a specific zoom level.
(Optional) A boolean indicating whether to use the layer's default styles. If true, any custom styles set via TileLayer.setStyleGroup are ignored and the default layer styles are returned. If false, the method will return the custom styles set for the feature if available; otherwise, it returns the default layer styles. Default is false.
A readonly StyleGroup representing the styles for the given feature at the specified zoom level. If no styles are found, a falsy value is returned, indicating that the feature is not displayed/visible.
Checks whether the xyz-maps tile layer is currently visible.
true
if the layer is visible, otherwise false
.Enable or disable pointer-event triggering for all features of the layer.
boolean to enable or disable posinter-events.
boolean indicating if pointer-event triggering is active or disabled.
Remove an EventListener from the layer. Valid events: "featureAdd", "featureRemove", "featureCoordinatesChange", "clear", "styleGroupChange", "styleChange", and "viewportReady"
A string which specifies the type of event for which to remove an event listener.
The listener function of the event handler to remove from the TileLayer.
Remove feature(s) from the layer.
features that should be removed from the layer
Search for feature(s) in the layer.
configure the search
search a feature by id.
Function to be called when a request of a "remote search" fails.
The error message of the failing request.
The name property represents a name for the type of error. The value is "NetworkError".
The responseText which contains the textual data received of the failing request.
The numerical HTTP status code of the failing request.
Callback function for "remote" search.
Force the data provider(s) to do remote search if no result is found in local cache.
array of features
Search for feature(s) in the layer.
configure the search
Array of feature ids to search.
Function to be called when a request of a "remote search" fails.
The error message of the failing request.
The name property represents a name for the type of error. The value is "NetworkError".
The responseText which contains the textual data received of the failing request.
The numerical HTTP status code of the failing request.
Callback function for "remote" search.
Geographical center point of the circle to search in. options.radius must be defined.
Radius of the circle in meters, it is used in "point" search.
Geographical Rectangle to search in. [minLon, minLat, maxLon, maxLat] | GeoRect.
Force the data provider(s) to do remote search if no result is found in local cache.
array of features
Rectangle Search for feature(s) in the layer.
Geographical Rectangle to search in. [minLon, minLat, maxLon, maxLat] | GeoRect.
configure the search
Function to be called when a request of a "remote search" fails.
The error message of the failing request.
The name property represents a name for the type of error. The value is "NetworkError".
The responseText which contains the textual data received of the failing request.
The numerical HTTP status code of the failing request.
Callback function for "remote" search.
Force the data provider(s) to do remote search if no result is found in local cache.
Circle Search for feature(s) in the layer.
Geographical center point of the circle to search in. options.radius must be defined.
configure the search
Function to be called when a request of a "remote search" fails.
The error message of the failing request.
The name property represents a name for the type of error. The value is "NetworkError".
The responseText which contains the textual data received of the failing request.
The numerical HTTP status code of the failing request.
Callback function for "remote" search.
the radius is mandatory for circle search.
Force the data provider(s) to do remote search if no result is found in local cache.
Search for feature by id in the layer.
id of the feature to search for
configure the search
Modify coordinates of a feature in the layer.
the Feature whose coordinates should be modified
the modified coordinates to set. The coordinates must match features geometry type.
Set the tile margin in pixel.
the tileMargin
Set layer with given style.
the layerStyle
keep and reuse custom set feature styles that have been set via TileLayer.setStyleGroup
Set StyleGroup the feature should be rendered with. Pass styleGroup = false|null to hide the feature. If no styleGroup is passed, custom feature style will be cleared and layer default style will be set.
the feature that's styleGroup should be set
the styleGroup that feature should be displayed with
Sets the visibility of the Layer.
This function controls whether the tile layer is currently displayed or hidden.
Generated using TypeDoc
The
ClusterTileLayer
class is a specialized TileLayer designed to efficiently handle clustering of GeoJSON data from various DataSources/DataProviders.This layer aggregates data points within map tiles to reduce visual clutter and improve performance, particularly when dealing with large datasets. When features are being added or removed from the DataSources, the ClusterTileLayer automatically updates to reflect the changes. Data will be clustered for each zoom level optimally from min up to clusterMaxZoom. For zoom levels below clusterMaxZoom and upto min, the untouched source data features will be displayed.
Additionally, the
ClusterTileLayer
supports cluster property aggregation, allowing developers to customize how properties are aggregated when features are added or removed from the cluster. The following methods are available for property aggregation:createProperties(featureProperties: { [propertyName: string]: any }): { [propertyName: string]: any }
: Creates initial properties for a cluster based on the properties of a feature.addProperties(clusterProperties: { [propertyName: string]: any }, featureProperties: { [propertyName: string]: any }): void
: Updates cluster properties when a feature is added to the cluster.removeProperties(clusterProperties: { [propertyName: string]: any }, featureProperties: { [propertyName: string]: any }): void
: Updates cluster properties when a feature is removed from the cluster.This layer also utilizes the ClusterFeature class to represent clusters.
ClusterFeature
// Create a new ClusterTileLayer with specified options const myLayer = new ClusterTileLayer({ min: 2, // Minimum zoom level to cluster and display the layer max: 20, // Maximum zoom level the layer will be displayed clusterMaxZoom:13, // the maximum zoom level data will be clustered clusterRadius: 15, // Cluster radius in pixels provider: myDataProvider // The data provider that data should be clustered });