import type { DisplayFilteredLayer } from "@arcgis/core/layers/mixins/DisplayFilteredLayer.js";- Subclasses
- CSVLayer, CatalogLayer, FeatureLayer, GeoJSONLayer, OGCFeatureLayer, StreamLayer, SubtypeGroupLayer, WFSLayer, KnowledgeGraphSublayer
- Since
- ArcGIS Maps SDK for JavaScript 4.32
DisplayFilteredLayer is a mixin that adds displayFilterEnabled and displayFilterInfo properties to a layer.
Properties
| Property | Type | Class |
|---|---|---|
| | ||
| |
displayFilterEnabled
- Type
- boolean
Indicates whether the layer's displayFilterInfo is applied when rendering the layer in the view.
If false, the layer's display filter is ignored and all features are rendered without filtering.
To ignore display filters across all layers in the view, set the view's View.displayFilterEnabled
property to false.
- Default value
- true
displayFilterInfo
- Type
- DisplayFilterInfo | null | undefined
Information related to a display filter associated with a layer. Display filters control which features are visible on the map. They allow you to display a subset of features while retaining access to all features
for querying and analysis. Unlike FeatureLayer.definitionExpression, which filters data at the source level, display filters only affect visibility on the map.
Therefore display filters should be ignored when querying data to present to users.
Display filters can be disabled for all layers in the map by setting the view's View.displayFilterEnabled property to false.
Notes:
To optimize memory usage for rendering, display filters may be appended to the layer's FeatureLayer.definitionExpression when querying the service.
As a result, the filtered features may not be available on the client for executing layer view queries.
To determine if all features are available in the view, check the layer view's FeatureLayerView.hasAllFeaturesInView
property when layer view's FeatureLayerView.dataUpdating is false. If false, the layer view does not have all features in the view
and you should query the layer instead.
- Example
- // set a scale-dependent display filter on a layerconst layer = new FeatureLayer({portalItem: {id: "28dbd58ad90e4a47ab0e0334d2b69427"},minScale: 0,maxScale: 0,outFields: ["*"],// set scale-dependent display filters to declutter the display at different scales.// Show more streams as user zooms in and less as user zooms out.displayFilterInfo: new DisplayFilterInfo({mode: "scale",filters: [{title: "streamOrder >= 8",minScale: 0,maxScale: 18_489_297.737236,where: "streamOrder >= 8"},{title: "streamOrder >= 6",minScale: 18_489_297.737236maxScale: 9_244_648.868618,where: "streamOrder >= 6"},{title: "streamOrder >= 4",minScale: 9_244_648.868618,maxScale: 577790.5542885where: "streamOrder >= 4"},{title: "all",minScale: 577790.5542885,maxScale: 0}]})});