This sample shows how to highlight point features in a layer. To highlight a feature, call the
highlight method of the feature's corresponding
layerView with the feature or its object
as parameter. When
passing features as parameters, they need to have an object
. You can also pass the name of a pre-configured or
custom HighlightOptions you want to use. Otherwise the
default will be used.
view.whenLayerView(layer).then((layerView) => {
// if a feature is already highlighted, then remove the highlight
if (highlightSelect) {
highlightSelect.remove();
}
// set the highlight on the first feature returned by the query
highlightSelect = layerView.highlight(feature);
});