ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / FeatureClassDescription Class
Members Example

In This Topic
    FeatureClassDescription Class
    In This Topic
    Represents a mechanism to create a ArcGIS.Core.Data.FeatureClass.
    Object Model
    FeatureClassDescription ClassShapeDescription ClassSubtypeFieldDescription Class
    Syntax
    public class FeatureClassDescription : TableDescription 
    Public Class FeatureClassDescription 
       Inherits TableDescription
    Example
    64-bit Integer field
    FieldDescription bigIntegerFieldDescription = new FieldDescription("BigInteger_64", FieldType.BigInteger);
    
    ObjectID field
    // 64-bit
    FieldDescription oidFieldDescription_64 = new FieldDescription("ObjectID_64", FieldType.OID)
    {
        Length = 8
    };
    
    // 32-bit
    FieldDescription oidFieldDescription_32 = new FieldDescription("ObjectID_32", FieldType.OID)
    {
        Length = 4
    };
    
    DateOnly, TimeOnly, and TimestampOffset field
    // Earthquake occurrences date and time
    
    // 9/28/2014 (DateOnly)
    FieldDescription earthquakeDateOnlyFieldDescription = new FieldDescription("Earthquake_DateOnly", FieldType.DateOnly);
    
    // 1:16:42 AM (TimeOnly)
    FieldDescription earthquakeTimeOnlyFieldDescription = new FieldDescription("Earthquake_TimeOnly", FieldType.TimeOnly);
    
    // 9/28/2014 1:16:42.000 AM -09:00 (Timestamp with Offset)
    FieldDescription earthquakeTimestampOffsetFieldDescription = new FieldDescription("Earthquake_TimestampOffset_Local", FieldType.TimestampOffset);
    
    // 9/28/2014 1:16:42 AM (DateTime)
    FieldDescription earthquakeDateFieldDescription = new FieldDescription("Earthquake_Date", FieldType.Date);
    
    Creating a FeatureDataset with a FeatureClass in one operation
    public void CreateFeatureDatasetWithFeatureClassSnippet(Geodatabase geodatabase)
    {
        // Creating a FeatureDataset named as 'Parcel_Information' and a FeatureClass with name 'Parcels' in one operation
    
        string featureDatasetName = "Parcel_Information";
        string featureClassName = "Parcels";
    
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Create a FeatureDataset token
        FeatureDatasetDescription featureDatasetDescription = new FeatureDatasetDescription(featureDatasetName, SpatialReferences.WGS84);
        FeatureDatasetToken featureDatasetToken = schemaBuilder.Create(featureDatasetDescription);
    
        // Create a FeatureClass description
        FeatureClassDescription featureClassDescription = new FeatureClassDescription(featureClassName,
          new List<FieldDescription>()
          {
      new FieldDescription("Id", FieldType.Integer),
      new FieldDescription("Address", FieldType.String)
          },
          new ShapeDescription(GeometryType.Point, SpatialReferences.WGS84));
    
        // Create a FeatureClass inside a FeatureDataset
        FeatureClassToken featureClassToken = schemaBuilder.Create(new FeatureDatasetDescription(featureDatasetToken), featureClassDescription);
    
        // Build status
        bool buildStatus = schemaBuilder.Build();
    
        // Build errors
        if (!buildStatus)
        {
            IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
        }
    }
    Creating a FeatureClass in existing FeatureDataset
    public void CreateFeatureClassInsideFeatureDatasetSnippet(Geodatabase geodatabase)
    {
        // Creating a FeatureClass named as 'Tax_Jurisdiction' in existing FeatureDataset with name 'Parcels_Information'
        string featureDatasetName = "Parcels_Information";
        string featureClassName = "Tax_Jurisdiction";
    
        // Create a FeatureClass description
        FeatureClassDescription featureClassDescription = new FeatureClassDescription(featureClassName,
          new List<FieldDescription>()
          {
      new FieldDescription("Tax_Id", FieldType.Integer),
      new FieldDescription("Address", FieldType.String)
          },
          new ShapeDescription(GeometryType.Point, SpatialReferences.WGS84));
    
        FeatureDatasetDefinition featureDatasetDefinition = geodatabase.GetDefinition<FeatureDatasetDefinition>(featureDatasetName);
    
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Create a FeatureClass inside a FeatureDataset using a FeatureDatasetDefinition
        schemaBuilder.Create(new FeatureDatasetDescription(featureDatasetDefinition), featureClassDescription);
    
        // Build status
        bool buildStatus = schemaBuilder.Build();
    
        // Build errors
        if (!buildStatus)
        {
            IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
        }
    }
    Adding a Field that uses a domain
    public void AddFieldWithDomainSnippet(Geodatabase geodatabase)
    {
        // Adding a field,'PipeType', which uses the coded value domain to the 'Pipes' FeatureClass
    
        //The FeatureClass to add field
        string featureClassName = "Pipes";
    
        SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
        // Create a CodedValueDomain description for water pipes
        CodedValueDomainDescription pipeDomainDescription =
          new CodedValueDomainDescription("WaterPipeTypes", FieldType.String,
          new SortedList<object, string> { { "C_1", "Copper" },
      { "S_2", "Steel" } })
          {
              SplitPolicy = SplitPolicy.Duplicate,
              MergePolicy = MergePolicy.DefaultValue
          };
    
        // Create a coded value domain token
        CodedValueDomainToken codedValueDomainToken = schemaBuilder.Create(pipeDomainDescription);
    
        // Create a new description from domain token
        CodedValueDomainDescription codedValueDomainDescription = new CodedValueDomainDescription(codedValueDomainToken);
    
        // Create a field named as 'PipeType' using a domain description
        FieldDescription domainFieldDescription = new FieldDescription("PipeType", FieldType.String);
        domainFieldDescription.SetDomainDescription(codedValueDomainDescription);
    
        //Retrieve existing information for 'Pipes' FeatureClass
        FeatureClassDefinition originalFeatureClassDefinition = geodatabase.GetDefinition<FeatureClassDefinition>(featureClassName);
        FeatureClassDescription originalFeatureClassDescription =
          new FeatureClassDescription(originalFeatureClassDefinition);
    
        // Add domain field on existing fields
        List<FieldDescription> modifiedFieldDescriptions = new List<FieldDescription>(originalFeatureClassDescription.FieldDescriptions) { domainFieldDescription };
    
        // Create a new description with updated fields for 'Pipes' FeatureClass 
        FeatureClassDescription featureClassDescription =
          new FeatureClassDescription(originalFeatureClassDescription.Name, modifiedFieldDescriptions,
                                         originalFeatureClassDescription.ShapeDescription);
    
        // Update the 'Pipes' FeatureClass with domain field
        schemaBuilder.Modify(featureClassDescription);
    
        // Build status
        bool buildStatus = schemaBuilder.Build();
    
        // Build errors
        if (!buildStatus)
        {
            IReadOnlyList<string> errors = schemaBuilder.ErrorMessages;
        }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.DDL.Description
          ArcGIS.Core.Data.DDL.TableDescription
             ArcGIS.Core.Data.DDL.FeatureClassDescription
                ArcGIS.Core.Data.DDL.AnnotationFeatureClassDescription

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also