Edit operation on ArcGIS Pro SDK

09-15-2021 05:21 PM
New Contributor II

I am trying to create a simple Add-In tool that will allow users to select features from a feature layer, clip the selected features and merge them together. For example, if there is a shapefile of all the counties in California and the user wants to clip and merge their study area from this county shapefile by selecting two counties as their study area. I am relatively new to ArcGIS Pro SDK and add-in. I am not sure if I am declaring the intermediate, clipped feature layer, clipArea and new, merged feature layer, new_fc correctly. Just curious, when would you use "//await mergeFeatures.ExecuteAsync()"? The indentation is not correctly shown below. Thanks for your help!


namespace ArcGISPro_Mapping_Apps
internal class SelectFeature : MapTool
public SelectFeature()
IsSketchTool = true;
SketchType = SketchGeometryType.Polygon;
SketchOutputMode = SketchOutputMode.Screen;


protected override Task OnToolActivateAsync(bool active)
return base.OnToolActivateAsync(active);

protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
QueuedTask.Run(() => {
var selection = MapView.Active.SelectFeatures(geometry);
var editOp = new EditOperation();
var clipArea = MapView.Active.Map.GetLayerAsFlattenedList().First(1 => 1.Name == "Area_clip");
var new_fc = MapView.Active.Map.GetLayerAsFlattenedList().First(1 => 1.Name == "StudyArea_merge");
var oid = -1;

Geometry clippedGeometry = GeometryEngine.Instance.Clip(geometry, clippedDistance);
editOp.Name = "clip and merge features";
editOp.Clip(selection, oid, clipArea, ClipMode.PreserveArea);
editOp.Merge(clipArea, new_fc, new List<long>() { 10, 96, 12 });

// Execute the edit operation
//await mergeFeatures.ExecuteAsync();
MessageBox.Show("Study area has been clipped successfully.");
return true;


0 Kudos
2 Replies
by Esri Regular Contributor
Esri Regular Contributor

Can you clarify your workflow?  In your pseudo code you take the digitized geometry and select all features intersected by that polygon, then you clip using the the same digitized geometry.

So you start with this (i am using US Counties here):


then you end up with this study area:


Is this your intended workflow?

0 Kudos
New Contributor II

Hi Wolf, 

The user will be selecting the counties, which are part of their study area or importing their study area boundary (shp) onto the map. I would like to clip and merge the selected counties or clip the boundary area as you have shown, if they decide to import their boundary area instead. 

0 Kudos