在要素数据集中创建要素类

简介: public IFeatureClass IFeatureDataset__CreateFeatureClass(IFeatureDataset featureDataset, String nameOfFeatureClass) { // This function creates a n...
public IFeatureClass IFeatureDataset__CreateFeatureClass(IFeatureDataset featureDataset, String nameOfFeatureClass)
{

// This function creates a new feature class in a supplied feature dataset by building all of the
// fields from scratch. IFeatureClassDescription (or IObjectClassDescription if the table is 
  // created at the workspace level) can be used to get the required fields and are used to 
  // get the InstanceClassID and ExtensionClassID.
// Create new fields collection with the number of fields you plan to add. Must add at least two fields
// for a feature class: Object ID and Shape field.
IFields fields = new FieldsClass();
IFieldsEdit fieldsEdit = (IFieldsEdit)fields;
fieldsEdit.FieldCount_2 = 3;

// Create Object ID field.
IField fieldUserDefined = new Field();

IFieldEdit fieldEdit = (IFieldEdit)fieldUserDefined;
fieldEdit.Name_2 = "OBJECTID";
fieldEdit.AliasName_2 = "OBJECT ID";
fieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
fieldsEdit.set_Field(0, fieldUserDefined);

// Create Shape field.
fieldUserDefined = new Field();
fieldEdit = (IFieldEdit)fieldUserDefined;

// Set up geometry definition for the Shape field.
// You do not have to set the spatial reference, as it is inherited from the feature dataset.
IGeometryDef geometryDef = new GeometryDefClass();
IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef;
geometryDefEdit.GeometryType_2 = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline;

// By setting the grid size to 0, you are allowing ArcGIS to determine the appropriate grid sizes for the feature class. 
// If in a personal geodatabase, the grid size is 1,000. If in a file or ArcSDE geodatabase, the grid size
// is based on the initial loading or inserting of features.
geometryDefEdit.GridCount_2 = 1;
geometryDefEdit.set_GridSize(0, 0);
geometryDefEdit.HasM_2 = false;
geometryDefEdit.HasZ_2 = false;

// Set standard field properties.
fieldEdit.Name_2 = "SHAPE";
fieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
fieldEdit.GeometryDef_2 = geometryDef;
fieldEdit.IsNullable_2 = true;
fieldEdit.Required_2 = true;
fieldsEdit.set_Field(1, fieldUserDefined);

// Create a field of type double to hold some information for the features.
fieldUserDefined = new Field();

 fieldEdit = (IFieldEdit)fieldUserDefined;
fieldEdit.Name_2 = "Avg_income";
fieldEdit.AliasName_2 = "Average income for 1999-2000";
fieldEdit.Editable_2 = true;
fieldEdit.IsNullable_2 = false;
fieldEdit.Precision_2 = 2;
fieldEdit.Scale_2 = 5;
fieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
fieldsEdit.set_Field(2, fieldUserDefined);

// Create a feature class description object to use for specifying the CLSID and EXTCLSID.
IFeatureClassDescription fcDesc = new FeatureClassDescriptionClass();
IObjectClassDescription ocDesc = (IObjectClassDescription)fcDesc;

return featureDataset.CreateFeatureClass(nameOfFeatureClass, fields, ocDesc.InstanceCLSID, ocDesc.ClassExtensionCLSID, esriFeatureType.esriFTSimple, "SHAPE", "");

}

相关文章
|
9月前
|
存储 SQL 定位技术
ArcGIS三种筛选提取要素的方法
ArcGIS三种筛选提取要素的方法
853 0
|
2月前
|
搜索推荐
用户画像系列——推荐相关核心标签(偏好类)
用户画像系列——推荐相关核心标签(偏好类)
84 0
|
11月前
|
机器学习/深度学习 人工智能 自然语言处理
GraphIE:通过建模实例间和标签间依赖性联合抽取实体、关系和事件 论文解读
事件触发词检测、实体提及识别、事件论元抽取和关系抽取是信息抽取中的四个重要任务,它们被联合执行(联合信息抽取- JointIE),以避免错误传播并利用任务实例之间的依赖关系
133 1
|
10月前
|
机器学习/深度学习 自然语言处理 文字识别
探索图像数据中的隐藏信息:语义实体识别和关系抽取的奇妙之旅
探索图像数据中的隐藏信息:语义实体识别和关系抽取的奇妙之旅
|
12月前
|
JSON 自然语言处理 算法
手把手教学构建农业知识图谱:农业领域的信息检索+智能问答,命名实体识别,关系抽取,实体关系查询
手把手教学构建农业知识图谱:农业领域的信息检索+智能问答,命名实体识别,关系抽取,实体关系查询
手把手教学构建农业知识图谱:农业领域的信息检索+智能问答,命名实体识别,关系抽取,实体关系查询
ArcGIS:如何对要素类进行查询要素属性、更改符号、标记?
ArcGIS:如何对要素类进行查询要素属性、更改符号、标记?
288 1
|
12月前
|
自然语言处理
|
存储 NoSQL Linux
ArcGIS:如何创建地理数据库、创建要素类数据集、导入要素类、表?
ArcGIS:如何创建地理数据库、创建要素类数据集、导入要素类、表?
1532 0
|
XML 存储 JSON
1.基于Label studio的训练数据标注指南:信息抽取(实体关系抽取)、文本分类等
1.基于Label studio的训练数据标注指南:信息抽取(实体关系抽取)、文本分类等
1.基于Label studio的训练数据标注指南:信息抽取(实体关系抽取)、文本分类等
|
机器学习/深度学习 自然语言处理 知识图谱