ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / Merge Method / Merge(EditingRowTemplate,Layer,IEnumerable<Int64>) Method
The template to create the new merged feature with.
The layer of the source features to merge.
The oids of the source features to merge.
Example

In This Topic
    Merge(EditingRowTemplate,Layer,IEnumerable<Int64>) Method
    In This Topic
    Merge features into a new feature defined by a feature template.
    Syntax

    Parameters

    template
    The template to create the new merged feature with.
    sourceLayer
    The layer of the source features to merge.
    sourceOIDs
    The oids of the source features to merge.
    Exceptions
    ExceptionDescription
    Template, sourceLayer, sourceOIDs cannot be null. List of ObjectIDs cannot be empty
    Remarks
    The template can be in a different layer from the source.
    Example
    Edit Operation Merge Features
    // Merges multiple features from a source feature layer into a new feature, optionally using a template or inspector, and supports merging into a destination layer.
    await QueuedTask.Run(() =>
    {
      var mergeFeatures = new EditOperation() { Name = "Merge Features" };
    
      //Merge three features into a new feature using defaults
      //defined in the current template
      mergeFeatures.Merge(currentTemplate as EditingRowTemplate, featureLayer, [10, 96, 12]);
    
      //Merge three features into a new feature in the destination layer
      mergeFeatures.Merge(destinationLayer, featureLayer, [10, 96, 12]);
    
      //Use an inspector to set the new attributes of the merged feature
      var inspector = new Inspector();
      inspector.Load(featureLayer, objectId);//base attributes on an existing feature
      inspector["NAME"] = "New name";
      inspector["DESCRIPTION"] = "New description";
    
      //Merge features into a new feature in the same layer using the
      //defaults set in the inspector
      mergeFeatures.Merge(featureLayer, [10, 96, 12], inspector);
    
      //Execute to execute the operation
      //Must be called within QueuedTask.Run
      if (!mergeFeatures.IsEmpty)
      {
        //Execute and ExecuteAsync will return true if the operation was successful and false if not
        var result = mergeFeatures.Execute();
        //or use async flavor
        //await mergeFeatures.ExecuteAsync();
      }
    });
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also