You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {}
  • Firefox
  • Safari
  • undefined

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample shows how to query a mesh SceneLayerView to get more information about features visible in the view. The SceneLayerView query methods only execute queries against features that are visible in the view at the moment of the query.

The use case for this sample is to display more information about a building and to zoom to it when the user clicks on that building.

We can get the objectid of the feature the user clicked using the hitTest() method of the view. We use the result to create a query object:

view.hitTest(event).then(function (response) {

  // check if a graphic is returned from the hitTest
  if (response.results[0].graphic) {

    // create query
    var query = new Query();
    // the query will return results only for the feature with the graphic's objectid
    query.objectIds = [response.results[0].graphic.attributes.OBJECTID];
    // the query should return all attributes
    query.outFields = ["*"];

The query object is then passed to queryExtent() method, which returns the 3D extent of the feature, and to the queryFeatures() method, which returns the feature with all the attributes.

sceneLayerView.queryExtent(query).then(function(result) {
      target: result.extent,
      tilt: 60
      duration: 1000,
      easing: "out-expo"

sceneLayerView.queryFeatures(query).then(function(result) {

Additional scene layer query samples

Sample search results