1

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.

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Feb 18, 2019 at 16:00
1
  • Welcome to GIS SE; thanks for taking the tour. Please edit your question to include your code thus far and indicate what's not working. Commented Feb 18, 2019 at 16:33

1 Answer 1

2

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!

answered Feb 19, 2019 at 4:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.