Classdesc

Layer source to cluster vector data. Works out of the box with point geometries. For other geometry types, or if not all geometries should be considered for clustering, a custom geometryFunction can be defined.

Param: options

Constructor options.

Api

Hierarchy

Constructors

  • Parameters

    Returns Cluster

    Classdesc

    Layer source to cluster vector data. Works out of the box with point geometries. For other geometry types, or if not all geometries should be considered for clustering, a custom geometryFunction can be defined.

    Api

Methods

  • Add a single feature to the source. If you want to add a batch of features at once, call source.addFeatures() instead.

    Parameters

    Returns void

    Api

    stable

  • Add a batch of features to the source.

    Parameters

    Returns void

    Api

    stable

  • Increases the revision counter and dispatches a 'change' event.

    Returns void

    Api

  • Remove all features from the source.

    Parameters

    • Optional opt_fast: boolean

      Skip dispatching of removefeature events.

    Returns void

    Api

    stable

  • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

    Parameters

    Returns void

    Function

    Api

  • Iterate through all features on the source, calling the provided callback with each one. If the callback returns any "truthy" value, iteration will stop and the function will return the same value.

    Type Parameters

    • T

    • S

    Parameters

    • callback: ((feature) => S)

      Called with each feature on the source. Return a truthy value to stop iteration.

        • (feature): S
        • Parameters

          Returns S

    • Optional opt_this: T

      The object to use as this in the callback.

    Returns S

    The return value from the last call to the callback.

    Api

    stable

  • Iterate through all features whose bounding box intersects the provided extent (note that the feature's geometry may not intersect the extent), calling the callback with each feature. If the callback returns a "truthy" value, iteration will stop and the function will return the same value.

    If you are interested in features whose geometry intersects an extent, call the * source.forEachFeatureIntersectingExtent() method instead.

    When useSpatialIndex is set to false, this method will loop through all features, equivalent to ol.source.Vector#forEachFeature.

    Type Parameters

    • T

    • S

    Parameters

    • extent: Extent

      Extent.

    • callback: ((feature) => S)

      Called with each feature whose bounding box intersects the provided extent.

        • (feature): S
        • Parameters

          Returns S

    • Optional opt_this: T

      The object to use as this in the callback.

    Returns S

    The return value from the last call to the callback.

    Api

  • Iterate through all features whose geometry intersects the provided extent, calling the callback with each feature. If the callback returns a "truthy" value, iteration will stop and the function will return the same value.

    If you only want to test for bounding box intersection, call the * source.forEachFeatureInExtent() method instead.

    Type Parameters

    • T

    • S

    Parameters

    • extent: Extent

      Extent.

    • callback: ((feature) => S)

      Called with each feature whose geometry intersects the provided extent.

        • (feature): S
        • Parameters

          Returns S

    • Optional opt_this: T

      The object to use as this in the callback.

    Returns S

    The return value from the last call to the callback.

    Api

  • Gets a value.

    Parameters

    • key: string

      Key name.

    Returns any

    Value.

    Api

    stable

  • Get the closest feature to the provided coordinate.

    This method is not available when the source is configured with useSpatialIndex set to false.

    Parameters

    • coordinate: Coordinate

      Coordinate.

    • Optional opt_filter: ((feature) => boolean)

      Feature filter function. The filter function will receive one argument, the feature and it should return a boolean value. By default, no filtering is made.

        • (feature): boolean
        • Parameters

          Returns boolean

    Returns ol.Feature

    Closest feature.

    Api

    stable

  • Get the extent of the features currently in the source.

    This method is not available when the source is configured with useSpatialIndex set to false.

    Returns Extent

    Extent.

    Api

    stable

  • Get a feature by its identifier (the value returned by feature.getId()). Note that the index treats string and numeric identifiers as the same. So source.getFeatureById(2) will return a feature with id '2' or 2.

    Parameters

    • id: string | number

      Feature identifier.

    Returns ol.Feature

    The feature (or null if not found).

    Api

    stable

  • Get all features in the provided extent. Note that this returns all features whose bounding boxes intersect the given extent (so it may include features whose geometries do not intersect the extent).

    This method is not available when the source is configured with useSpatialIndex set to false.

    Parameters

    Returns ol.Feature[]

    Features.

    Api

  • Get a list of object property names.

    Returns string[]

    List of property names.

    Api

    stable

  • Get an object of all property names and values.

    Returns {
        [k: string]: any;
    }

    Object.

    • [k: string]: any

    Api

    stable

  • Get the version number for this object. Each time the object is modified, its version number will be incremented.

    Returns number

    Revision.

    Api

  • Listen for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object to use as this in listener.

    Returns Object | Object[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

    Api

    stable

  • Listen once for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object to use as this in listener.

    Returns Object | Object[]

    Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

    Api

    stable

  • Refreshes the source and finally dispatches a 'change' event.

    Returns void

    Api

  • Remove a single feature from the source. If you want to remove all features at once, use the source.clear() method instead.

    Parameters

    Returns void

    Api

    stable

  • Sets a value.

    Parameters

    • key: string

      Key name.

    • value: any

      Value.

    • Optional opt_silent: boolean

      Update without triggering an event.

    Returns void

    Api

    stable

  • Set the attributions of the source.

    Parameters

    • attributions: AttributionLike

      Attributions. Can be passed as string, Array<string>, {@link ol.Attribution}, Array<{@link ol.Attribution}> or undefined.

    Returns void

    Api

  • Set the distance in pixels between clusters.

    Parameters

    • distance: number

      The distance in pixels.

    Returns void

    Api

  • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

    Parameters

    • values: {
          [k: string]: any;
      }

      Values.

      • [k: string]: any
    • Optional opt_silent: boolean

      Update without triggering an event.

    Returns void

    Api

    stable

  • Unlisten for a certain type of event.

    Parameters

    • type: string | string[]

      The event type or array of event types.

    • listener: Function

      The listener function.

    • Optional opt_this: Object

      The object which was used as this by the listener.

    Returns void

    Api

    stable

  • Removes an event listener using the key returned by on() or once(). Note that using the ol.Observable.unByKey static function is to be preferred.

    Parameters

    • key: Object | Object[]

      The key returned by on() or once() (or an array of keys).

    Returns void

    Function

    Api

    stable

  • Unsets a property.

    Parameters

    • key: string

      Key name.

    • Optional opt_silent: boolean

      Unset without triggering an event.

    Returns void

    Api

    stable

  • Removes an event listener using the key returned by on() or once().

    Parameters

    • key: Object | Object[]

      The key returned by on() or once() (or an array of keys).

    Returns void

    Api

    stable

Generated using TypeDoc