Skip to main content

@mapgear/geoapps > LayerItem > GetFeaturesByFilter

LayerItem.GetFeaturesByFilter() method

Warning: This API is now obsolete.

We advice to use GetfeaturesByFilter2, which will provide more advanced filtering possibilities and also search for objects in the whole dataset, instead of only the objects that are currently loaded.

Retrieve the features specified by the filter in the parameter

Signature:
GetFeaturesByFilter(filter: I.Filter): I.Feature[];

Parameters

ParameterTypeDescription
filterI.FilterFilter object
Returns:

I.Feature[]

Features within the filter

Example

Retrieving the features by filter only allows selection based on a single attribute. It will search only in the already loaded features, e.g. the features in the extent.

An example to retrieve the data is as follows:

const features = layer.GetFeaturesByFilter({ attribute: "foo", value: "bar" });

The example shown above retrieves all the features where the attribute 'foo' equals to 'bar'