For now I am trying to create a webmap with the ArcGIS API (4.x) for JavaScript. I have a bit understanding of the workings of JavaScript, however I couldn't find code in which it's possible to select a feature (let's say a building) on the web map and return a string when selecting on this feature (such as the name of selected feature. I want to use the string of the name (e.g.) for another action.
1 Answer
Setup the click event (view.on("pointer-down", function(event) { ... });
), and in that click event use view.hitTest(event).then(function(hitTestResponse) { ... });
and within that function, you can get the attributes. A good example is here. Good luck!