1 ArcMap功能演示
Selection --> 选择要查询的字段值 --> Get Unique Values
2 IDataStatistics Interface
Members
3 AE实现代码
获取指定字段的唯一属性值,转载自:获取唯一值
public static IList<string> GetUniqueValue(ILayer Layer,string field) { IList<string> listValues = new List<string>(); //判断字段是否存在 if (flayer.FeatureClass.FindField(field)==-1) return listValues ; //去除字段为NULL字段 IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = field + " IS NOT NULL"; ICursor cursor = flayer.FeatureClass.Search(queryFilter , false) as ICursor; //获取唯一值 IDataStatistics dataStatistics = new DataStatisticsClass { //统计字段 Field = field, Cursor = cursor }; //获取唯一值枚举 System.Collections.IEnumerator enumerator = dataStatistics.UniqueValues; if (dataStatistics.UniqueValueCount==0) return listValues ; enumerator.Reset(); while (enumerator.MoveNext()) { //获取唯一值字段 listValues.Add(enumerator.Current.ToString()); } return listValues ; }