ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / CopyLineFeaturesToParcelType Method / CopyLineFeaturesToParcelType(Layer,IEnumerable<Int64>,Layer,Layer) Method
Source member where rows will be copied from.
Source row oids to copy.
Destination line layer where rows will be copied.
Destination polygon layer.
Example

In This Topic
    CopyLineFeaturesToParcelType(Layer,IEnumerable<Int64>,Layer,Layer) Method
    In This Topic
    Copies rows with the given IDs from the source to the destination. This function is for copying lines to parcel fabrics. Lines forming enclosed areas will have parcel seeds created within each area.
    Syntax
    Public Overloads Function CopyLineFeaturesToParcelType( _
       ByVal sourceLayer As Layer, _
       ByVal sourceOIDs As IEnumerable(Of Long), _
       ByVal destinationLineLayer As Layer, _
       ByVal destinationPolygonLayer As Layer _
    ) As ParcelEditToken

    Parameters

    sourceLayer
    Source member where rows will be copied from.
    sourceOIDs
    Source row oids to copy.
    destinationLineLayer
    Destination line layer where rows will be copied.
    destinationPolygonLayer
    Destination polygon layer.
    Exceptions
    ExceptionDescription
    SourceLayer, sourceIds, destinationLayerLayer and destinationPolygonLayer cannot be null.
    Insufficient license. This method requires a standard license.
    Example
    Copy standard line features into a parcel type
    string errorMessage = await QueuedTask.Run( async () =>
    {
      // check for selected layer
      if (MapView.Active.GetSelectedLayers().Count == 0)
        return "Please select a target parcel polygon layer in the table of contents.";
      //get the feature layer that's selected in the table of contents
      var destPolygonL = MapView.Active.GetSelectedLayers().OfType<FeatureLayer>().FirstOrDefault();
      try
      {
        var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
        //if there is no fabric in the map then bail
        if (myParcelFabricLayer == null)
          return "There is no fabric in the map.";
        var pRec = myParcelFabricLayer.GetActiveRecord();
        if (pRec == null)
          return "There is no Active Record. Please set the active record and try again.";
        string ParcelTypeName = "";
        IEnumerable<string> parcelTypeNames = await myParcelFabricLayer.GetParcelTypeNamesAsync();
        foreach (string parcelTypeNm in parcelTypeNames)
        {
          var polygonLyrParcelTypeEnum = await myParcelFabricLayer.GetParcelPolygonLayerByTypeNameAsync(parcelTypeNm);
          foreach (FeatureLayer lyr in polygonLyrParcelTypeEnum)
            if (lyr == destPolygonL)
            {
              ParcelTypeName = parcelTypeNm;
              break;
            }
        }
        if (String.IsNullOrEmpty(ParcelTypeName))
          return "Please select a target parcel polygon layer in the table of contents.";
        var srcFeatLyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(l => l.Name.Contains("MySourceLines") && l.IsVisible);
        if (srcFeatLyr == null)
          return "Looking for a layer named 'MySourceLines' in the table of contents.";
        //now get the line layer for this parcel type
        var destLineLyrEnum = await myParcelFabricLayer.GetParcelLineLayerByTypeNameAsync(ParcelTypeName);
        if (destLineLyrEnum.Count() == 0) //make sure there is one in the map
          return ParcelTypeName + " not found.";
        var destLineL = destLineLyrEnum.FirstOrDefault();
        if (destLineL == null || destPolygonL == null)
          return "";
        var editOper = new EditOperation()
        {
          Name = "Copy Line Features To Parcel Type",
          ProgressMessage = "Copy Line Features To Parcel Type...",
          ShowModalMessageAfterFailure = true,
          SelectNewFeatures = true,
          SelectModifiedFeatures = false
        };
        var ids = new List<long>((srcFeatLyr as FeatureLayer).GetSelection().GetObjectIDs());
        if (ids.Count == 0)
          return "No selected lines were found. Please select line features and try again.";
        editOper.CopyLineFeaturesToParcelType(srcFeatLyr, ids, destLineL, destPolygonL);
        if (!editOper.Execute())
          return editOper.ErrorMessage;
      }
      catch (Exception ex)
      {
        return ex.Message;
      }
      return "";
    });
    if (!string.IsNullOrEmpty(errorMessage))
      MessageBox.Show(errorMessage, "Copy Line Features To Parcel Type.");
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also