Arcgis for android获取FeatureLayer或者FeatureTable某个字段的唯一值
第一种,通过FeatureLayer的selectFeaturesAsync,查出来所有的feature,在将每个feature该字段的值保存起来,在去重,很慢。
- ListenableFuture listenableFuture = featureLayer.selectFeaturesAsync
- FeatureQueryResult featureQueryResult = listenableFuture.get()
- Iterator iterator = featureQueryResult.iterator()
- Feature feature = iterator.next()
- java.util.Map<String, Object> attr = feature.getAttributes()
第二种,通过FeatureTable的queryStatisticsAsync,只要将分组字段设置为该字段,很快可以得到该字段的唯一值。
- List mStatisticDefinitionList = new ArrayList<>(Arrays.asList(new StatisticDefinition(staFieldName, StatisticType.SUM))),统计字段和统计类型随便选择,合理的就行。
- StatisticsQueryParameters statQueryParams = new StatisticsQueryParameters(mStatisticDefinitionList);