new FilterAndSort(options [, metric])
Create an instance of FilterAndSort
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
options |
olx.source.VectorOptions | Constructor options |
||
metric |
boolean |
<optional> |
false | Use metric units |
- Source:
Extends
- Autoload
Methods
-
filter(filters)
-
Filters the features of this source
Parameters:
Name Type Description filtersArray.<Array.<module:nyc/ol/source/FilterAndSort~FilterAndSort.Filter>> Used to filter features by attributes
- Source:
Returns:
An array of features contained in this source that are the result of the intersection of the applied filters
- Type
- Array.<ol.Feature>
-
nearest(coordinate [, count])
-
Get nearest n features from a coordinate
Parameters:
Name Type Argument Description coordinateol.Coordinate The coordinate from which to measure distance to features
countNumber <optional>
The number of features to return
- Source:
Returns:
The features
- Type
- Array.<ol.Feature>
-
removeFeature(feature)
-
Remove a feature
Parameters:
Name Type Description featureol.Feature The feature to remove
- Source:
-
sort(coordinate)
-
Sort features by distance from a coordinate
Parameters:
Name Type Description coordinateol.Coordinate The coordinate from which to measure distance to features
- Source:
Returns:
The features, each decorated with a getDistance function that returns a module:nyc/ol/source/FilterAndSort~FilterAndSort.Distance object
- Type
- Array.<ol.Feature>
Type Definitions
-
Distance
-
Type:
- Object
- Source:
Properties:
Name Type Description distancenumber The distance
unitsstring The distance units
-
Filter
-
Argument object for module:nyc/ol/source/FilterAndSort~FilterAndSort#filter
Type:
- Object
- Source:
Properties:
Name Type Description propertystring The property name on which to filter features
valuesArray.<string> The values used to filter features