Class: VectorFilter

VectorFilter()

A VectorFilter Model represents one condition used to show or hide specific features of a vector layer on a map. The filter defines rules used to show features conditionally based on properties of the feature. For example, it could specify hiding all vectors for an asset that have an area greater than 10 km2.

Constructor

new VectorFilter()

Since:
  • 2.18.0
Source:

Extends

  • Backbone.Model

Members

defaults :Object

Default attributes for VectorFilter models
Type:
  • Object
Properties:
Name Type Attributes Default Description
filterType 'categorical' | 'numeric' <optional>
'categorical' If categorical, then a feature will be visible when its property value exactly matches one of those listed in the values attribute. If numerical, then a feature will be visible when its property value is between the min and max.
property string The property (attribute) of the feature to filter on.
values Array.<string> | Array.<number> Only used for categorical filters. If the property matches one of the values listed, the feature will be displayed. If the filter type is categorical and no values are set, then features will not be filtered on this property.
max number Only used for numeric filters. The property's value must be less than the value set here for the feature to be visible. If the filter type is numeric, and max is set, then the max is infinite.
min number Only used for numeric filters. The property's value must be greater than the value set here for the feature to be visible. If the filter type is numeric, and min is set, then the min is minus infinity.
Source:

type :string

The name of this type of model
Type:
  • string
Source:

Methods

featureIsVisible(properties) → {boolean}

This function checks if a feature is visible based on the filter's rules.
Parameters:
Name Type Description
properties Object The properties of the feature to be filtered. (See the 'properties' attribute of Feature#defaults.)
Source:
Returns:
Returns true if the feature properties pass this filter
Type
boolean