VisitLog.LogMS "记录所有的FeatureKey"
'遍历Allfeature记录
For i = 1 To main.Map1.Layers.Item("观测站").AllFeatures.Count
h1.Add main.Map1.DataSets.Item("观测站").Value(main.Map1.Layers.Item("观测站").AllFeatures(i).FeatureKey, "Name"), main.Map1.Layers.Item("观测站").AllFeatures(i).FeatureKey
Next
VisitLog.LogMS "完成记录所有的FeatureKey"
'遍历Allfeature记录
For i = 1 To main.Map1.Layers.Item("观测站").AllFeatures.Count
h1.Add main.Map1.DataSets.Item("观测站").Value(main.Map1.Layers.Item("观测站").AllFeatures(i).FeatureKey, "Name"), main.Map1.Layers.Item("观测站").AllFeatures(i).FeatureKey
Next
VisitLog.LogMS "完成记录所有的FeatureKey"
结果
46:27.158记录所有的FeatureKey
46:57.767完成记录所有的FeatureKey
总共才167个点。
--------------------------------------------------------------------------
改用for each
Dim ftr As Feature
For Each ftr In main.Map1.Layers.Item("¹Û²âÕ¾").AllFeatures
h1.Add main.Map1.DataSets.Item("¹Û²âÕ¾").Value(ftr.FeatureKey, "Name"), ftr.FeatureKey
Next
结果:
15:06.882记录所有的FeatureKey
15:08.007完成记录所有的FeatureKey
=================================================
结论:
mapx的allfeature的item索引是一个非常间接的处理,需要耗费大量的处理时间。