require(["esri/views/layers/support/FeatureFilter"], function(FeatureFilter) { /* code goes here */ });
Class: esri/views/layers/support/FeatureFilter
Inheritance: FeatureFilter Accessor
Since: ArcGIS API for JavaScript 4.11

This class defines parameters for setting a client-side filter on a layer view. Once a FeatureFilter object's properties are defined, it can be used to set the filter property of the layer view.

You can set filters by attributes, time, geometry and geometry with distance. Only the features that meet the requirements specified in the filter will be displayed. Filters only affect feature visibility. They do not return geometry or attribute information associated with the filtered features. The queryFeatures method must be called to access additional information.

The fields to be used for the filter must be present in the layer view's availableFields list.

// display rain gauges where their water percent is over 30%
// and if the gauges are completely contained by the 10-mile
// buffer around the filter geometry
featureLayerView.filter = new FeatureFilter({
  where: "percentile >= 30",
  geometry: filterPolygon,
  spatialRelationship: "contains",
  distance: 10,
  units: "miles"
});

screen-size-perspective

See also:

Constructors

new FeatureFilter(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Example:
// Typical usage
const filter = new FeatureFilter({
  where: "magnitude >= 3"
});
layerView.filter = filter;

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
String

The name of the class.

more details
more detailsAccessor
Number

Specifies a search distance from a given geometry in a spatial filter.

more details
more detailsFeatureFilter
Geometry

The geometry to apply to the spatial filter.

more details
more detailsFeatureFilter
Number[]

An array of objectIds of the features to be filtered.

more details
more detailsFeatureFilter
String

For spatial filters, this parameter defines the spatial relationship to filter features in the layer view against the filter geometry.

more details
more detailsFeatureFilter
TimeExtent

A range of time with start and end date.

more details
more detailsFeatureFilter
String

The unit for calculating the buffer distance when distance is specified in a spatial filter.

more details
more detailsFeatureFilter
String

A where clause for the feature filter.

more details
more detailsFeatureFilter

Property Details

declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

distance Number

Specifies a search distance from a given geometry in a spatial filter. The units property indicates the unit of measurement. In essence, setting this property creates a buffer at the specified size around the input geometry. The filter will use that buffer to display features in the layer or layer view that adhere to the to the indicated spatial relationship.

Known Limitations

On 3D object scene layers in SceneLayerView distance is not supported .

The geometry to apply to the spatial filter. The spatial relationship as specified by spatialRelationship will indicate how the geometry should be used to filter features.

Known Limitations

Mesh geometry types are currently not supported.

objectIds Number[]

An array of objectIds of the features to be filtered.

spatialRelationship String

For spatial filters, this parameter defines the spatial relationship to filter features in the layer view against the filter geometry. The spatial relationships discover how features are spatially related to each other. For example, you may want to know if a polygon representing a county completely contains points representing settlements.

The spatial relationship is determined by whether the boundaries or interiors of a geometry intersect.

  • Boundary — The endpoints of all linear parts for line features, or the linear outline of a polygon. Only lines and polygons have boundaries.
  • Interior — Points are entirely interior and have no boundary. For lines and polygons, the interior is any part of the geometry that is not part of the boundary.

The possible values for this parameter are described below and the images highlight the geometries returned for the specified spatial relationship for given geometries.

The intersects spatial relationship returns features in the layer view that intersect the filter geometry.

Known Limitations

The filter of SceneLayerView with 3D object scene layers only supports the spatialRelationsship contains, intersects and disjoint.

intersects

The contains spatial relationship returns features in the layer view that are completely contained by the filter geometry.

contains

The crosses spatial relationship returns features in the layer view when the interior of a filter geometry comes into contact with the interior or boundary of features in the layer view. In other words, the geometries share some interior area, but not all interior area.

crosses

The envelope-intersects spatial relationship returns features in the layer view that intersect the envelope (or extent) of the filter geometry.

envelope-intersects

The overlaps spatial relationship returns features in the layer view that overlap the filter geometry. Only features of the same geometry can be compared.

overlaps

The touches spatial relationship returns features in the layer view that touch the filter geometry. The boundaries of the geometries intersect, but not their interiors.

touches

The within spatial relationship returns features in the layer view that completely contain the filter geometry. In other words, the filter geometry is completely within the features in the layer view. It is opposite of contains.

within

The disjoint spatial relationship returns features in the layer view that do not intersect the filter geometry in anyway. Opposite of intersects.

disjoint

Default Value:intersects
See also:
Example:
// display features that are completely within state
var filter = new FeatureFilter({
  spatialRelationship: "contains",
  geometry: statePolygon
});
timeExtent TimeExtent

A range of time with start and end date. Only the features that fall within this time extent will be displayed.

Known Limitations

On 3D object scene layers in SceneLayerView timeExtent is not supported .

Default Value:null
units String

The unit for calculating the buffer distance when distance is specified in a spatial filter. If units is not specified, the unit is derived from the filter geometry's spatial reference.

Possible Values: feet | miles | nautical-miles | us-nautical-miles | meters | kilometers

Default Value:null
where String

A where clause for the feature filter. Any legal SQL92 where clause operating on the fields in the layer is allowed. Be sure to have the correct sequence of single and double quotes when writing the where clause in JavaScript. The field to be used for where clause must be added to outFields list when the layer is initialized.

Known Limitations

On 3D object scene layers in SceneLayerView where is not supported .

See also:
Examples:
filter.where = "NAME = '" + stateName + "'";
filter.where = "POP04 > " + population;

Method Overview

NameReturn TypeSummaryClass
FeatureFilter

Creates a deep clone of FeatureFilter object.

more details
more detailsFeatureFilter
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more detailsFeatureFilter
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsFeatureFilter

Method Details

clone(){FeatureFilter}

Creates a deep clone of FeatureFilter object.

Returns:
TypeDescription
FeatureFilterA new instance of a FeatureFilter object equal to the object used to call .clone().
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() topic in the Guide for more information.

Returns:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule
Loading...