Highlight point features

This sample shows how to highlight features in a layer. Features in SceneLayer, FeatureLayer, CSVLayer, GeoRSSLayer and GraphicsLayer can be highlighted.

To highlight a feature, call the highlight method of the feature's corresponding layerView with the feature or its objectID as parameter. When passing features as parameters, they need to have an objectID.

1
2
3
4
5
6
7
8
9
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);
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close