Edit Operation Error Using Clip

02-21-2022 08:39 PM
New Contributor III

I tried to use the inspector and edit operation to clip selected feature from a feature class, but I am getting an error at SelectedLayer. I am also not sure how I should address oid. Is this the oid of the new clipped feature class?  Please see my code below. Thanks for your help!

public async Task SelectionLayer_Inspector()
await QueuedTask.Run(() =>
var MV = MapView.Active;
var MU_Layer = MV.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(fl => fl.Name.Contains("MUPOLYGON")).FirstOrDefault();
var SelectedLayer = MV.Map.GetSelection();
var oid = new List<long>();

var inspector = new Inspector();
inspector.LoadAsync(SelectedLayer.Keys.First(), SelectedLayer.Values.First());
var Mukeys = inspector["mukey"];
return Mukeys;

var clipOp = new EditOperation();
clipOp.Name = "clip the selected layer";
clipOp.Clip(MU_Layer, oid, SelectedLayer, ClipMode.PreserveArea);


0 Kudos
2 Replies
Esri Regular Contributor


At first "return Mukeys;" breaks code execution at this point and your clip operation will not be executed.

More information about EditOperation Clip method here:


From your question difficult to understand that task do you want to realize. Do you want to clip single feature or selected features? What is your clipping geometry and etc.

From your 

0 Kudos
New Contributor III

I want to clip the selected feature from MUPOLYGON. I basically want to extract the selected input feature, SelectionLayer that overlay the clip feature, MUPOLYGON. Thanks for your help!

0 Kudos