ArcObjects Library Reference (GeoDatabase)  

IFeatureWorkspace.CreateFeatureClass Method

Creates a new standalone feature class under the workspace.

[Visual Basic .NET]
Public Function CreateFeatureClass ( _
    ByVal Name As String, _
    ByVal Fields As IFields, _
    ByVal CLSID As UID, _
    ByVal EXTCLSID As UID, _
    ByVal FeatureType As esriFeatureType, _
    ByVal ShapeFieldName As String, _
    ByVal ConfigKeyword As String _
) As IFeatureClass
[C#]
public IFeatureClass CreateFeatureClass (
    string Name,
    IFields Fields,
    UID CLSID,
    UID EXTCLSID,
    esriFeatureType FeatureType,
    string ShapeFieldName,
    string ConfigKeyword
);
[C++]
HRESULT CreateFeatureClass(
  BSTR Name,
  IFields* Fields,
  IUID* CLSID,
  IUID* EXTCLSID,
  esriFeatureType FeatureType,
  BSTR ShapeFieldName,
  BSTR ConfigKeyword,
  IFeatureClass** oclass
);
[C++]

Parameters

Name [in]   Name is a parameter of type BSTR Fields [in]

  Fields is a parameter of type IFields

CLSID [in]

  CLSID is a parameter of type IUID

EXTCLSID [in]

  EXTCLSID is a parameter of type IUID

FeatureType [in]

  FeatureType is a parameter of type esriFeatureType

ShapeFieldName [in]   ShapeFieldName is a parameter of type BSTR ConfigKeyword [in]   ConfigKeyword is a parameter of type BSTR oclass [out, retval]

  oclass is a parameter of type IFeatureClass

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned

FDO_E_CANNOT_CREATE_LOW_PREC_DATASET_IN_HIGH_PREC_DB: Cannot create a low precision dataset in a high precision database.

FDO_E_CANNOT_CREATE_HIGH_PREC_DATASET_IN_LOW_PREC_DB: Cannot create a high precision dataset in a low precision database

Functional License Check

If your application/site is not appropriately licensed, CreateFeatureClass can return an Err.Number of FDO_E_NO_SCHEMA_LICENSE.

Remarks

The CreateFeatureClass method can be used to create a stand-alone feature class that is not part of a feature dataset. It takes, in addition to all the parameters that CreateTable takes, an esriFeatureType parameter that specifies the category of features to be stored in this feature class (i.e., esriFTSimple, esriFTComplexEdgeFeature) and a shape field name. The shape field name identifies the name of the field in the input fields collection that represents the shape field for the feature class.

The Fields object passed to the Fields parameter should not be an object retrieved from another class. If the new class is going to have the same fields as an existing class, cast the existing class' fields collection to the IClone interface, clone it, and use the cloned fields collection as input for this method.

The GeometryDef object associated with the shape field object must be fully setup with a spatial reference, grid properties, and the geometry type before calling CreateFeatureClass.

The following esriGeometryType enumeration values represent the valid geometry types for a new feature class' GeometryDef object: esriGeometryPoint, esriGeometryMultipoint, esriGeometryPolyline, esriGeometryPolygon, and esriGeometryMultiPatch.

If the feature class is being created in geodatabase then the fields collection must contain, at a minimum, an Object ID field and a Shape field. The required fields can be obtained from the class description for the type of object you wish to create (see the RequiredFields property on IObjectClassDescription).

The CLSID parameter is used to specify what type of feature will be contained by the class. If a null value is passed in for the CLSID, the geodatabase will return Feature instances from the class. In most cases, this is the desired behavior. If the feature class is used to store custom features, the GUID of the custom feature should be provided. Alternatively, the IClassSchemaEdit interface can be used to change the feature class' CLSID following creation.

The EXTCLSID parameter is used to specify what class will be instantiated as the feature class extension. This object must at least support the IClassExtension interface. If a null value is passed in for the EXTCLSID parameter, the feature class will not have a class extension associated with it. Since class extensions are not required, this is often the desired behavior. If the feature class should have an associated extension, the GUID of the class extension should be provided. Alternatively, the IClassSchemaEdit interface can be used to associate a class extension following creation.

The configurationKeywordparameter allows the application to control the physical layout for this table in the underlying RDBMS. For example, in the case of an Oracle database, the configuration keyword controls the tablespace in which the table is created, the initial and next extents, and other properties. The configuration keywords for an ArcSDE instance are set up by the ArcSDE data administrator, and the list of available keywords supported by a workspace may be obtained using the IWorkspaceConfigurationinterface.

If the workspace the feature class will be created in is a pre-9.2 geodatabase, you must ensure the GeometryDef references a low precision spatial reference. 9.1 and earlier versions of the geodatabase only support low precision spatial references, while 9.2 geodatabases require high precision spatial references. Use IControlPrecision2::IsHighPrecision to manage the precision level of the spatial reference used to create the feature class. Use the IGeodatabaseRelease interface to determine the release of the geodatabase.

Developers should be aware that calling this method on a shapefile workspace when a shapefile of the same name already exists will cause the existing shapefile to be deleted. To prevent this, check for the existence of a shapefile prior to calling this method.

Note:Table or feature class names with the following prefixes are not supported:


 ~ "gdb_"
 ~ "sde_"
 ~ "delta_"

See Also

IFeatureWorkspace Interface