ArcGIS Engine 创建索引(属性索引)——提高查询效率

转自原文 ArcGIS Engine 创建索引(属性索引)——提高查询效率

 

众所周知,建立索引可以提高查询的效率,当对FeatureClass中的某一列频繁的查找,且数据量比较大时,建立索引是非常有必要的。

这里介绍一下,用 ArcGIS Engine 来建立一个属性索引。

    IIndex pIndex = new IndexClass();  
    IIndexEdit pIndexEdit = pIndex as IIndexEdit;  
    IFields pFields = new FieldsClass();  
    IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;  
    int feildindex = pFeatureClass.Fields.FindField("Name");  
    IField pField = pFeatureClass.Fields.Field[feildindex];  
    pFieldsEdit.FieldCount_2 = 1;  
    pFieldsEdit.set_Field(0, pField);  
    pIndexEdit.Fields_2 = pFields;  
    pIndexEdit.Name_2 = zidField;  
    pIndexEdit.IsAscending_2 = true;  
    pFeatureClass.AddIndex(pIndex);  

 

posted @ 2017-08-28 22:19  wenglabs  阅读(1279)  评论(0编辑  收藏  举报