Class: FeatureBin

ol.source. FeatureBin

A source that use a set of feature to collect data on it. If a binSource is provided the bin is recalculated when features change.


new FeatureBin(options)

Parameters:
Name Type Description
options Object

ol.source.VectorOptions + grid option

Properties
Name Type Argument Description
source ol.source.Vector

source to collect in the bin

binSource ol.source.Vector

a source to use as bin collector, default none

features Array.<ol.Feature>

the features, ignored if binSource is provided, default none

size number <optional>

size of the grid in meter, default 200m

geometryFunction function <optional>

Function that takes an ol.Feature as argument and returns an ol.geom.Point as feature's center.

flatAttributes function <optional>

Function takes a bin and the features it contains and aggragate the features in the bin attributes when saving

Extends

Methods


_flatAttributes(bin, features)

Create bin attributes using the features it contains when exporting

Parameters:
Name Type Description
bin ol.Feature

the bin to export

features Array.<ol.Features>

the features it contains

Inherited From:
Overrides:

clear()

Overwrite ol/source/Vector clear to fire clearstart / clearend event

Inherited From:
Overrides:

getBin(f)

Get the bin that contains a feature

Parameters:
Name Type Description
f ol.Feature

the feature

Inherited From:
Overrides:
Returns:

the bin or null it doesn't exit

Type
ol.Feature

getBinAt(coord, create)

Get the bean at a coord

Parameters:
Name Type Description
coord ol.Coordinate
create boolean

true to create if doesn't exit

Inherited From:
Overrides:
Returns:

the bin or null it doesn't exit

Type
ol.Feature

getGridFeatures()

Get features without circular dependencies (vs. getFeatures)

Inherited From:
Overrides:
Returns:
Type
Array.<ol.Feature>

getGridGeomAt(coord)

Get the grid geometry at the coord

Parameters:
Name Type Description
coord ol.Coordinate
Overrides:
Returns:
Type
ol.geom.Polygon

getSource()

Get the orginal source

Inherited From:
Overrides:
Returns:
Type
ol.source.Vector

reset()

Clear all bins and generate a new one.

Inherited From:
Overrides:

setFeatures(features)

Set features to use as bin collector

Parameters:
Name Type Description
features ol.Feature

setFlatAttributesFn(fn)

Set the flatAttribute function

Parameters:
Name Type Description
fn function

Function that takes a bin and the features it contains and aggragate the features in the bin attributes when saving

Inherited From:
Overrides: