Skip to content

This sample demonstrates how to apply a featureEffect to an instance of a FeatureLayer. FeatureEffect is used to draw attention features of interest by highlighting the features that meet the filter requirements or by dimming the features that do not meet the filter requirements.

In this sample, a Histogram component is used with a Slider to highlight block groups in Phoenix, AZ if they fall within the age range specified by the slider’s thumb values. As user moves the thumbs, the application updates the filter property of the layer’s featureEffect and applies the following included and excluded effects.

// this function is called when the map is loaded
// and when user changes the histogram range slider thumbs
function applyFeatureEffect(layer, where) {
layer.featureEffect = {
filter: {
where,
},
includedEffect: "bloom(0.9 0.6pt 0)",
excludedEffect: "blur(2.25pt) opacity(0.5)",
};
}