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

FeatureEffect allows you to emphasize or deemphasize features that satisfy a filter in 2D MapView. The includedEffect and excludedEffect properties allow you to apply CSS filters to features that are either included or excluded from the filter. Typically, you use includedEffect to emphasize features that are included in the filter and excludedEffect to deemphasize features excluded from the filter.

Known Limitations

  • The feature effect cannot be applied to a layer view with a heatmap renderer.
  • FeatureEffect is not supported in layers with featureReduction of type cluster enabled.
  • FeatureEffect is not supported in 3D SceneViews.
// apply feature effect to features that do not
// meet the filter requirements
 featureFilter = {
  // autocasts to FeatureFilter
  geometry: filterGeometry,
  spatialRelationship: geometryRel,
  distance: distance,
  units: unit
};
// set effect on excluded features
// make them gray and transparent
if (featureLayerView) {
  featureLayerView.effect = {
    filter: featureFilter,
    excludedEffect: "grayscale(100%) opacity(30%)"
  }
}
See also:

Constructors

new FeatureEffect(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 effect = new FeatureEffect({
  filter:{
    where: "magnitude >= 3"
  }
  excludedEffect: "grayscale(100%) opacity(30%)"
});
layerView.effect = effect;

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
String

The graphical css filter operation applied to the features that do not meet the filter requirements.

more details
more detailsFeatureEffect
Boolean

Indicates if labels for features that are excluded from the effect are visible.

more details
more detailsFeatureEffect
FeatureFilter

The filter that drives the effect.

more details
more detailsFeatureEffect
String

The graphical css filter operation applied to the features that meet the filter requirements.

more details
more detailsFeatureEffect

Property Details

declaredClass Stringreadonly inherited

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

excludedEffect String

The graphical css filter operation applied to the features that do not meet the filter requirements. Currently, grayscale, sepia, hue-rotate, invert, opacity, brightness and contrast css filter functions are supported.

Example:
const excludedEffect = "grayscale(50%) opacity(30%)";
layerView.effect = {
  filter: {
    where: "1=1",
    geometry: mapPoint,
    spatialRelationship: "disjoint",
    distance: searchDistance,
    units: searchUnit
  },
   excludedEffect: excludedEffect
};
excludedLabelsVisible Boolean

Indicates if labels for features that are excluded from the effect are visible.

Default Value:false

The filter that drives the effect. Features that meet the requirements specified in the filter will have the includedEffect applied while features that do not meet meet the filter requirements will have the excludedEffect applied.

includedEffect String

The graphical css filter operation applied to the features that meet the filter requirements. Currently, grayscale, sepia, hue-rotate, invert, opacity, brightness and contrast css filter functions are supported.

Example:
const includedEffect = "sepia(70%) saturate(1500%) hue-rotate(320deg) opacity(60%)";
layerView.effect = {
  filter: {
    where: "1=1",
    geometry: mapPoint,
    spatialRelationship: "disjoint",
    distance: searchDistance,
    units: searchUnit
  },
   includedEffect: includedEffect,
};

Method Overview

NameReturn TypeSummaryClass
FeatureEffect

Creates a deep clone of FeatureEffect object.

more details
more detailsFeatureEffect
*

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 detailsFeatureEffect
Object

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

more details
more detailsFeatureEffect

Method Details

clone(){FeatureEffect}

Creates a deep clone of FeatureEffect object.

Returns:
TypeDescription
FeatureEffectA new instance of a FeatureEffect
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...