Replicate Explore tool feature selection functionality

535
2
01-06-2021 10:32 AM
Labels (1)
MarvisKisakye1
Occasional Contributor

When a user clicks on a map, I am creating a buffer around the clicked point and using a SpatialQueryFilter to select features that intersect the buffer. The distance that I use to create the buffer should depend on how zoomed in/out the user is. I am essentially attempting to replicate the Explore tool's feature selection functionality. I tried utilising SelectionEnvironment.SelectionTolerance as below:

 

var bufferGeom = GeometryEngine.Instance.Buffer(clickedPnt, SelectionEnvironment.SelectionTolerance)

 

but this gives me the same buffer distance at all zoom levels such that even when the user is zoomed in at 1:1, I still get multiple features included in my query which is not what I need. @UmaHarano @Wolf 

Tags (1)
2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can't replicate the  Explore tool's feature selection functionality.  The selection tolerance is in pixels and the actual selection in Pro works on the graphics level considering the visible size of the selected graphic items.  Pro creates a buffer in pixels around the graphic items in the map view and then correlates them back to the feature owning the graphic.  You can utilize the selection tool built into Pro (you can create your own tool button to customize the tool in your code) and then perform your workflow on the selection changed event.

0 Kudos
MarvisKisakye1
Occasional Contributor

@Wolf I cannot use pro's selection tool because I need to select by POINT which is not available in the pro selection options. That is why I am utilizing a MapTool. When the user draws a point, I am attempting to create a buffer and select features in the buffer but I run into the issues that I explained in my original post. That is how to get a buffer distance that varies based on the scale. 

0 Kudos