Module 19 - hitTest and Highlight

Level 4 路 Interaction 路 馃煛 路 3 hours 路 Prereq: Module 18


What you'll build

A selection system: hover to preview, click to select, shift-click to add to selection, drag-box to select many, Escape to clear - with highlights that respect a theme and a selection list that stays in sync with the map.


Why this matters

"What did the user click?" sounds trivial and is not. hitTest is asynchronous, returns multiple results in draw order, includes graphics from layers you didn't mean, gives you generalised geometry, and behaves differently in 3D.

Selection is also the interaction every map application needs and most get subtly wrong.


The full lesson is part of the Interaction & Widgets level of Web GIS Development with the ArcGIS Maps SDK for JavaScript.