创建、添加字段IFields
轉載自:http://blog.sina.com.cn/s/blog_84f7fbbb010199gx.html
從ACCESS讀取數據到ArcGIS個人數據庫并創建Feature Class(point)
轉載:http://www.cnblogs.com/qiushuixizhao/p/3242685.html
如何創建一個要素數據類 IField,IFieldEdit,IFields,IFieldsEditI,GeometryDef,IGeometryDefEdit接口
如何創建一個要素數據類?
創建要素類用到了IFeatureWorkspace.CreateFeatureClass方法,在這個方法中有眾多的參數,為了滿足這些參數,我們要學習和了解下面的接口.?
IField,IFieldEdit,IFields,IFieldsEditI,GeometryDef,IGeometryDefEdit接口?
字段對應表中的一列,一個要素類必須有至少2個字段,而多個字段的集合就構成了字段集,在要素類中,有一個特殊的字段,描述了空間對象,我們稱之為幾何字段,其中GeometryDef是用來設計幾何字段的。這個幾何字段定義了要素類的類型,比如說我們要在Catalog創建一個點要素類,那么我們必須指定他的類型為Point。
而上面這6個接口,其實是三類,以Edit結尾的接口是可寫的,也就是說對字段,字段集合,以及幾何字段的編輯都是通過后者完成的。空間數據的一個重要屬性就是參考系,參考系也是在GeometryDef中定義的。?
注意 在NET中,會遇到以“_2”結尾的屬性,這些屬性是可寫的。
IGeometryDefEdit Interface接口
Members
| ? | AvgNumPoints | The estimated average number of points per feature. |
| ? | AvgNumPoints | The estimated average number of points per feature. |
| ? | GeometryType | The enumerated geometry type. |
| ? | GeometryType | The geometry type. |
| ? | GridCount | The number of spatial index grids. |
| ? | GridCount | The number of spatial index grids. |
| ? | GridSize | The size of a spatial index grid. |
| ? | GridSize | The size of a spatial index grid. |
| ? | HasM | Indicates if the feature class has measure (M) values. |
| ? | HasM | Indicates if the feature class will support M values. |
| ? | HasZ | Indicates if the feature class will support Z values. |
| ? | HasZ | Indicates if the featureClass has Z values. |
| ? | SpatialReference | The spatial reference for the dataset. |
| ? | SpatialReference | The spatial reference of the dataset. |
?
?
//定義一個幾何字段,類型為點類型 ISpatialReference pSpatialReference = axMapControl1.ActiveView.FocusMap.SpatialReference; //空間參考系IGeometryDefEdit pGeoDef = new GeometryDefClass(); IGeometryDefEdit pGeoDefEdit = pGeoDef as IGeometryDefEdit; pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint; pGeoDefEdit.SpatialReference_2 = pSpatialReference; //定義一個字段集合對象 IFields pFields = new FieldsClass(); IFieldsEdit pFieldsEdit = (IFieldsEdit)pFields; //定義單個的字段 IField pField = new FieldClass(); IFieldEdit pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = "SHAPE"; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFieldsEdit.AddField(pField); pFieldEdit.GeometryDef_2 = pGeoDef; //定義單個的字段,并添加到字段集合中 pField = new FieldClass(); pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = "STCD"; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString; pFieldsEdit.AddField(pField); //定義單個的字段,并添加到字段集合中 pField = new FieldClass(); pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = "SLM10"; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString; pFieldsEdit.AddField(pField); //定義單個的字段,并添加到字段集合中 pField = new FieldClass(); pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = "SLM20"; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString; pFieldsEdit.AddField(pField); //定義單個的字段,并添加到字段集合中 pField = new FieldClass(); pFieldEdit = (IFieldEdit)pField; pFieldEdit.Name_2 = "SLM40"; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString; pFieldsEdit.AddField(pField); IWorkspaceFactory pFtWsFct = new AccessWorkspaceFactory(); IFeatureWorkspace pWs = pFtWsFct.OpenFromFile(@"E:\arcgis\Engine\s.mdb", 0) as IFeatureWorkspace; IFeatureClass pFtClass = pWs.CreateFeatureClass("Test", pFields, null, null, esriFeatureType.esriFTSimple, "SHAPE", null)?創建字段
方法一:IQueryFilter接口
Description
IQueryFilterfilters data based on an attribute query. A string defining a where clause is required. An optional list of columns may be included to specify the column values to be retrieved. If no columns are specified, all values will be returned.
When To Use
When you need to filter data based on attribute values or the relationships between attributes.
Members
?
Method AddField Appends a single field name to the list of sub-fields.
Read/write property OutputSpatialReference ?The spatial reference in which to output geometry for a given field.
Read/write property SubFields The comma delimited list of field names for the filter.
Read/write property WhereClause The where clause for the filter.
?
轉載于:https://www.cnblogs.com/marvelousone/p/7457436.html
總結
以上是生活随笔為你收集整理的创建、添加字段IFields的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 光瓶酒靠前的有哪些酒?
- 下一篇: js 查找当前元素/this