1

I am trying to access features of a featurelayer in a SceneView on click event. I have seen this example from Esri's documentation for ArcGIS API for JavaScript but this example is for a MapView. When I change MapView to SceneView, the graphic property of the object that is returned by view.hitTest is always null, even if I click on a feature.

I simply just replaced every MapView in the code to SceneView. The map loads fine, click event works (i.e. it returns x,y coordinates of the click).

1 Answer 1

1

from the API reference:

FeatureLayer.hitTest(screenPoint)

... Draped graphics (i.e. graphics in layers where the elevation mode is on-the-ground) are currently not returned from this method, even when they intersect the input screen point.

because on-the-ground is the default elevation mode for feature layers with polyline geometry, it is currently necessary to set the property manually in the sample you referenced in order for hitTest() to return what you want.

var layer = new FeatureLayer({
  // ...
  elevationInfo: { mode: "absolute-height" }
});
1
  • you're very welcome Commented Jan 15, 2017 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.