Hello all -
I am stymied by a simple error that I cannot resolve. I have a map tool that will be used to change an attribute value of a feature with each click. In testing, the sketch geometry is created correctly, and the tool's OnSketchCompleteAsync method fires as well. However, when passing the sketch geometry to MapView.Active.GetFeatures returns an empty SelectionSet every time, not matter where I click on the map.
protected override async Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
var mapView = MapView.Active;
await QueuedTask.Run(() =>
{
var intersectedFeatures = mapView.GetFeatures(geometry);
if (!intersectedFeatures.IsEmpty) // This clause is never reached.
{
mapView.FlashFeature(intersectedFeatures);
if (intersectedFeatures.Contains(WoodlandsManager.Current.CurrentPlan))
{
var plan_feature = intersectedFeatures[WoodlandsManager.Current.CurrentPlan].FirstOrDefault();
Inspector inspector = new Inspector();
inspector.Load(WoodlandsManager.Current.CurrentPlan, plan_feature);
inspector["Prescription"] = _prescription;
EditOperation editOperation = new EditOperation();
editOperation.Modify(inspector);
editOperation.Execute();
}
}
else // This clause always is.
{
MessageBox.Show("No features at the point you clicked.");
}
});
return true; I have tried using SketchGeometryType.Point, Polygon, and Line, and SketchOutputMode.Screen and Map.
Any suggestions on why the empty SelectionSet would be greatly appreciated!