Access features with pointer events

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

This sample shows how to use the hitTest() method on the MapView to access features in a FeatureLayer. This is done by setting up a pointer-move event handler on the view and passing the returned screen x, y coordinates to the hitTest() method of the view. A promise is returned, which resolves to an array of objects containing any features from a GraphicsLayer or FeatureLayer.

view.on("pointer-move", function(event){
       // do something with the result graphic
       var graphic = response.results[0].graphic;

The sample displays hurricane paths. Click any line segment to view some of its attributes and assign the same symbol to all line segments with the same storm name.

Sample search results


There were no match results from your search criteria.