How can I get hold of all highlighted features in a feature layer/feature layer view?

952
2
Jump to solution
12-14-2020 07:52 AM
MathiasDahl
New Contributor III

Hi,

I have been able to find information on how to highlight (new term, was select in the 3.x API) features in a feature layer via the view. I now wonder how I can get hold of the features that are currently highlighted.

We want to build a tool where the user clicks to select, sorry, highlights, a number of features. When she is ready, she will activate another command that will do something with the highlighted features. We need to be able to get access to all the feature's attributes as well, but I assume we will be able to do that once we have access to the feature.

Thanks!

/Mathias

 

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

I built something similar with SketchViewModel. Here is a sample app that should have most of the pieces you need.

View solution in original post

0 Kudos
2 Replies
BlakeTerhune
MVP Regular Contributor

I built something similar with SketchViewModel. Here is a sample app that should have most of the pieces you need.

0 Kudos
MathiasDahl
New Contributor III

Thanks Blake!

I actually found that sample but I did not see clearly if it tried to "get the set of highlighted objects." I see now that you save the query result in that graphics variable and use that later in the code (rather than to query for/list the highlighted features themselves).

I could probably do that, although in my case I want the user to be able to click to select multiple individual objects. But I could probably just save each clicked feature before/when I highlight it and use that collection of features/graphics when I want to "do something" with the features.

So, I think we have a way forward - thanks!

/Mathias