How to create a map tool that selects only one feature when click on a point with a tolerance.
For now I can use ActiveMapView.SelectFeatures(geometry), but this method can select multiple feature layer or multiple feature in a layer.
var selection = ActiveMapView.SelectFeatures(clickedPoint, method: SelectionCombinationMethod.New);
Solved! Go to Solution.
I don't know what you mean by
// this statment
oids = oid;
However I was able to get the answer from the method you have mentioned GetFeatures(geometry).
Thank you for your help.
You most likely want FeatureLayer Select(...). https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11392.html
Something like:
var sqf = new SpatialQueryFilter() {
FilterGeometry = clickedPoint,
SpatialRelationship = SpatialRelationship.Intersects,//change as needed
WhereClause = "Optional SQL whereclause here",
SubFields = "*"
};
var selection = featLayer.Select(sqf);
How can I get the featureLayer ?
What about this:
var features = mapView.GetFeatures(point);
if (features.ContainsKey(layer))
{
var tag = features.FirstOrDefault(t => t.Key == layer);
var oids = tag.Value;
foreach (var oid in oids)
{
oids = oid;
}
var filter = new QueryFilter
{
WhereClause = " OBJECTID = " + oid
};
var select = layer.Select(filter);
I don't know what you mean by
// this statment
oids = oid;
However I was able to get the answer from the method you have mentioned GetFeatures(geometry).
Thank you for your help.